Link to home
Start Free TrialLog in
Avatar of Edo082297
Edo082297

asked on

Using CreateProcess to run report

Hi

My application has to launch Paradox (any version) and run a report. I am fighting a losing battle to get CreateProcess to work. However, I still want to use this call. How do I get it to work? Assume I have the path to the correct version. Part 2: How can I disable my app from opening another version of this report; don't say, disable the button, because I still need to re-enable it, which brings us back to the same problem.
Avatar of d003303
d003303

Why are you so bound on the CreateProcess commend ? Why don't you use OLE automation to solve this problem ?

Slash/d003303
ASKER CERTIFIED SOLUTION
Avatar of Greedy
Greedy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Edo082297

ASKER

I am using CreateProcess for this because I need to instantiate a separate thread for the WaitForSingleObjectEx call. I do not want the user playing with the 'main' application while the Paradox portion is going, d003303.


I am using CreateProcess for this because I need to instantiate a separate thread for the WaitForSingleObjectEx call. I do not want the user playing with the 'main' application while the Paradox portion is going, d003303.

I grade Greedy's answer as good, only because I got it to work with less code. Is this better? Perhaps not. I used GetStartupInfo instead of intializing the STARTUP_INFO structure myself (is this necessary?), and because I am not sure of the role of zCurDir and WorkDir. Also, why is the WaitForSingleObject call in an else portion? Isn't this counter-intuitive, or is this the way it's done? While you're at it, greedy, could I have used OLE automation to do this? Would I want to?