I am using legacy Fortran on Compaq Visual Fortran. I create an executable (femanalysis.exe) using either QuickWin or as a Console Application. I then use it within a Matlab code spring.m which calls it recurrently (hundreds of times) and it's working well except for one problem. Although I directed all output from femanalysis.exe to a file (away from the screen), the femanalysis.exe still pops up an empty frame windows at the start of each execution. Given that the program is called repeatedly by spring.m, I end up with empty frame windows appearing continuously on my screen while the Matlab program is running, hence preventing other usage of my computer. How to prevent the windows from appearing at all? Thanks.
If you are creating and exe then your matlab code is not really "calling" femanalysis.exe, it is running it. When femanalysis.exe is finished the calculation does it not close itself and delete its own window? If it is a quickwin program just having it run minimised and then to close properly would probably solve your problem.
Instead of issuing a matlab run program "femanalysis.exe args here>output.dat"
try running "start /B /WAIT femanalysis.exe args here>output.dat"
or: "start /MIN /WAIT femanalysis.exe args here>output.dat"
The program START will handle the window issue
If you want a program to have no visible user interface, create it as a "Windows Application", with a WinMain entry point. Don't create any windows, just run your code. You can start with the template you get from Visual Studio and just throw away all the executable code other than setting the return status.
Thank you all for taking the time to respond. Suggestion by Steve works (after struggling a little with making the linker recognize WinMain as main entry - since I am using the ancient Compaq Visual Fortran). Thank you Steve: I have been struggling with this for a couple of days, so it's such a relief.
Andrew: I tried minimizing the window in the InitialSettings function (by entering qw%type=QWIN$MIN), but the program still pops up a regular size frame window. Not sure why.
Jim: Couldn't make it work, probably because of my lack of familiarity with running from a dos command window. (I am running Matlab interactively). Was planning to try again but the problem's solved.
For future reference
>>Couldn't make it work, probably because of my lack of familiarity with running from a dos command window.
Your (former) non-desired case was likely executing the external program by way of:
system('femanalysis.exe args here>output.dat')
Change this to:
system('start /B /WAIT femanalysis.exe args here>output.dat')
system('start /MIN /WAIT femanalysis.exe args here>output.dat')
start is a program (shell program)
Your solution to create the program as a windows application intrigues me. I write a lot of Quickwin apps, and I too sometimes wish that the project frame window did not appear. While I can do without the Quickwin user interface, sometimes my apps need other quickwin features like the graphics library. This brings up my question:
Is there any way to create an application that uses the quickwin graphics library to create graphs, but without the project frame window? (I realize--I think--that if I need the graph to appear in its own window I would have to manage that using API calls.)
I don't know of any way to create a QuickWin app without a frame (or full-screen graphics). You might want to consider OpenGL for more flexibility.
You might ( I haven't used Quickwin for a long time) be able to just hide the frame window:
ret = ShowWindow (handle_of_frame_window, SW_HIDE) ! api call
But you would need to add some code also so that when you close the child window you call then Quickwin exit (Winexit?? from memory) to close the hidden frame window.
EDIT That said, if you hide the frame window then the children will hide also so that does not work........