Topic: pop-up console window

Dear Jeff,
I have returned to Fortran programming after quite a long hiatus and to my great pleasure
I find that both Modern Fortran and Simply Fortran are rapidly moving forward.
From now, I will definitely use AppGraphics for designing GUI interfaces for my applications.
In that connection, let me ask about the following problem.
After, for example

call execute_command_line (".\bin\png2bmp -Q -A -R .\png\data2d.png", exitstat=istat),

the command prompt window pops-up for a moment and then disappears.
Is it possible to avoid such flashing of command console screen?
The main program is, of course, compiled with "Windows GUI (No console)" option.
Regards,
Carlos

Re: pop-up console window

Carlos,

The problem you're experiencing is highly Windows-specific.  When you select the "Windows GUI" option in Project Options, the console for your program is not created.  This also means that the program you've written doesn't have standard input and output handles.

When you call execute_command_line from Fortran, it starts a Windows cmd.exe process.  That process requires standard input and output handles.  Because your program can't provide them, a new window is opened to provide them to the command shell.

For a solution that is Windows-specific, you could write a routine that wraps the CreateProcess API call, which would allow you to call the program directly without the shell command.  It's a complex API call, but a simple wrapper routine could be written to encapsulate its complexity.  If that's something you'd be interested in, I can write up some code for it.

Jeff Armstrong
Approximatrix, LLC

Re: pop-up console window

Jeff,
Thanks for the rapid response. That would be great if you can write a wrapper for an appropriate
system call. I hope that it is possible to run programs synchronously, as with execute_command_line.
I hope also, that it is possible to redirect the output from the console to a "log" file.
I will appretiate any help since I have no experience in win API programing.
Regards,
Carlos