View previous topic :: View next topic |
Author |
Message |
Wilfried Linder
Joined: 14 Nov 2007 Posts: 314 Location: Düsseldorf, Germany
|
Posted: Fri Jan 22, 2016 12:19 am Post subject: CISSUE@ / hide DOS windows |
|
|
In some cases I have to call old DOS programs with the cissue@() method. Even if there is no input and no output from the DOS program, an ugly (black) DOS window opens and stays on the screen until the program terminates. I made a lot of efforts to suppress this window, but in vain. No I found a very simple workaround which may be of interest for some of you:
Just use %ww[topmost] in the first window of your main program. Now, all DOS windows are at least displayed "behind" the main window, and if the latter one is in full-screen mode, the DOS windows are completely invisible.
Regards - Wilfried |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7927 Location: Salford, UK
|
Posted: Fri Jan 22, 2016 9:15 am Post subject: |
|
|
A call to WinExec sometimes does the trick and this has an argument that hides the window. I don't remember if this works for console programs. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Fri Jan 22, 2016 8:47 pm Post subject: |
|
|
Wilfried,
Isn't cmd.exe just another Windows program? Surely that means you can find out what it is called and send it a message to go off and hide itself?
I'm assuming that they are not DOS programs that you could recompile yourself ... |
|
Back to top |
|
|
dgurok
Joined: 26 May 2011 Posts: 66
|
Posted: Tue Feb 16, 2016 10:53 am Post subject: |
|
|
In this case I'm using ShellExecuteEx + WaitForSingleObject.
You can use parameter SW_HIDE to hide the application. It also works for Batch and Console application. |
|
Back to top |
|
|
Wilfried Linder
Joined: 14 Nov 2007 Posts: 314 Location: Düsseldorf, Germany
|
Posted: Wed May 04, 2016 9:56 am Post subject: |
|
|
Here is a different solution using a script:
Code: | subroutine create_vbs()
include <windows.ins>
integer*4 j,start_process@
open(10,file='run_dosapp.vbs',status='unknown')
write(10,'(A)')'Set WshShell = WScript.CreateObject("WScript.Shell")'
write(10,'(A)')'WshShell.Run "c:\old_stuff\my_dos_app.exe",0,True'
close(10)
j = start_process@('wscript','run_dosapp.vbs')
end
|
The Parameter "True" is used to hide the DOS box when "my_dos_app.exe" is running.
Wilfried |
|
Back to top |
|
|
dgurok
Joined: 26 May 2011 Posts: 66
|
Posted: Wed May 18, 2016 8:33 am Post subject: |
|
|
Paul,
I have observed something strange with respect starting an external program in main application. During the execution (after some seconds) of the external program the window position of main application shifts by few pixel. When I close the executed external program the window position of the main application shits back to the original position. With the debugger I can't reproduce this behavior. Is it possible to turn off this behavior somehow? |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7927 Location: Salford, UK
|
Posted: Wed May 18, 2016 8:57 am Post subject: |
|
|
I doubt that this can be fixed. It is probably something to do with Windows.
If you could post some code that demonstrates this behaviour then I would have a better idea of what is possible. |
|
Back to top |
|
|
dgurok
Joined: 26 May 2011 Posts: 66
|
Posted: Wed May 18, 2016 9:35 am Post subject: |
|
|
This code illustrates my problem simplified:
Code: | program test
C
INTEGER*4
* I,f_func
C
external f_func
I=WINIO@('%ca[test]&')
I=WINIO@('%sp&', 1, 1)
I=WINIO@('%sz&', 1920, 1080) !+ fullscreen
I=WINIO@('%^bt[start_process and wait]', f_func)
end
C
C
function f_func()
C
integer*4
* f_func,
* i,
* start_process@
C
i = start_process@('calc.exe',' ')
f_func=1
C
end |
Please start the external process and after some seconds the position of main window will shift. When you close calc.exe the position of main window will shift back. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7927 Location: Salford, UK
|
Posted: Wed May 18, 2016 10:28 am Post subject: |
|
|
It doesn't happen for me on Windows 8.1.
Which operating system are you using? |
|
Back to top |
|
|
dgurok
Joined: 26 May 2011 Posts: 66
|
Posted: Wed May 18, 2016 10:51 am Post subject: |
|
|
I'm using Windows 7 (64-bit), FTN95 7.10.0
Window positioning ok:
Window positioning shifted when external program is executed:
I observed it has something to do with the used design/visual effects in windows. With the windows basic or classic design there is no shifting in windows 7. When I use Aero the problem occurs. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7927 Location: Salford, UK
|
Posted: Wed May 18, 2016 11:32 am Post subject: |
|
|
OK. So it looks like it is something that we would not be able fix within ClearWin+. I doubt very much that you will be able to fix this. |
|
Back to top |
|
|
|