RunQQ Function

RunQQ Function

Hello People

RunQQ is a Run-Time Function for execution of another program
Its syntax is:

result = RUNQQ (filename, commandline)

Is there any way to use commandline as input/output? Or, in other words, how can I send information back to the calling program?
Do I have to use a COM Server/Client?

Thanks in advance


12 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

You can send information back on the command line arguments If the callee is designed to accept it. Otherwise it will ignore it.

A Com client is no different, if the other program does not want to talk to your client then it's not gonna happen.

So it all depends on the interface to the callee.
It would be the User interface for the case of RUNQQ
and Programming interface (API) in the case of the com-client.

You can for example run a typical DOS command like delete and use the argument to tell it which file:

Lest to confuse you more, the third choice is CREATEPROCESS which is a generalized form of RUNQQ.


[pre]Thank you TimH[/pre]
I like RunQQ because it is simple to debug, but it is read only.
I have not begun to work with com-client yet.
Where could I find information about CreateProcess?

No, the commandline argument is readonly. There are any number of IPC mechanisms available depending upon what sort of data you would like to provide back to the original program.


[pre]Sorry I did not answer sooner[/pre]
[pre]Commandline argument is read only, therefore it is necessary to use another method to send back information.[/pre]
[pre]I can make a text string with my information using some rule to separate the variables, for example separating them with brackets, therefore let us think about transferring back a string[/pre]. How can I do it?

Mailslots provide an easy solution. Here is a simple example (no error handling):


use kernel32
character(*), parameter :: IPCname = ".mailslotmymbx"
integer, parameter :: IPCsize = 128
character(IPCsize) IPCdata
integer(HANDLE) hMail
integer(DWORD) size


program parent
use dflib
include 'mbx.def'
hMail = CreateMailslot(IPCname,IPCsize,0,NULL)
call RUNQQ('child',' ')
if (ReadFile(hMail,LOC(IPCdata),IPCsize,LOC(size),NULL) /= 0) type *, IPCdata(:size)


program child
include 'mbx.def'
call time(IPCdata)
call WriteFile(hMail,LOC(IPCdata),LEN_TRIM(IPCdata),LOC(size),NULL)

Save the three files and build the two programs as console apps, then run the parent program which will return a time string from the child.


A tip. Don't add the .def file to the project's "Source Files", otherwise the linker will try to read it because .DEF is a kind of file the linker uses. If you just save the file in the same folder as the other sources, Developer Studio will find it. Or, rename the .def file to be .inc or .fi or something like that (and change the INCLUDE)


Retired 12/31/2016

Thank you James
Ohh! Is this the pipe?
As I understand it, the section defined as mbx.def is something like a module defining global variables for both programs, Parent and Child.
Parent Program creates a file with the parameters of this module and the Child program writes on it the information that it is wanted to be transferred. Then, the Parent program reads the file.
Then, it would be better to send the information about the common file directly in the parameter of the RunQQ and to make your own protocol, isn?t it?
As I understand it, the pipe then would be a shared file where you write the information you want to be transfered between the programs.
It seems good to me, although f90SQL considers it obsolete.Is there any other way?

This isn't a pipe but a mailslot. Take a look at for more details.

The .DEF file in just included by both the parent and child program, just insert its contents into those two files and eliminate it if you like. As Steve points out, that file extension also has other meanings if used in Developer studio. However it is just code that in included for compilation.

There is no file involved, despite the name of the routine, rather a mailslot is an in memory structure that allows the one way communication from the slave to the parent that you were looking for.


Hello James
This is exactly the information I needed.
I appreciate very much your kindness.
Best Regards

You could start with my CVF Newsletter Article on CreateProcess.

You'd probably need to use a pipe to get data back from the subprocess - my article doesn't cover that.


Retired 12/31/2016

Is it secured to use mailslot? I mean if my data contains huge info, does it transfer safely?



Leave a Comment

Please sign in to add a comment. Not a member? Join today