Using CreateProcess

Using CreateProcess

I am trying to get a console application to display and run in the same window as a parent quickwin application. I am using the code below:

StartupInfo = T_STARTUPINFO(SIZEOF(StartupInfo),0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
print *,'What is the name of the executable to run?'
read '(a)',exec_name
ret = CreateProcess (NULL_CHARACTER, exec_name, null_security_attributes, null_security_attributes, true, 0,null, null, startupinfo, processinfo)

Whenever I complie and run my quickwin application, the console applicaiton that I call starts in it's own window. I want it to use the parent window. Any suggestions?

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Steve Lionel (Intel)'s picture

I don't see how you can - the QuickWin window is NOT a console window, even though it may look like one.

Steve

Steve

Here's exactly what I'm trying to do. My boss has developed several fortran executables as console applications. These executables accept and output text to and from the user.
I need to develop a windows based executable that can serve as an interface for any of my boss's executables. He'd like to be able to start my window's based exe and call any of his executables and have the input/output displayed in my exe's window (i.e. no independent console window for his executable is created). My problem is that my code still causes a separate console window to be created for my boss's executable.

Steve Lionel (Intel)'s picture

You'll have to create two pipes and redirect the boss' program input and output to the pipes. Then in your main program, have threads that send input to the in pipe and read it from the out pipe, displaying the output using Fortran I/O in the QuickWin window. You can specify the pipes in your call to CreateProcess.

Steve

Steve

Login to leave a comment.