>I want to be able to run another Windows application from within VFP5. How can I tell if it is currently running, and if it is, how do I bring it to the screen.
>
>Also, how do I stop execution of the VFP program while this application is running?
>
Hi Dennis,
Check the file download section here at the UT in the Win32 and other APIs section. Look for "Is a Windows Application Running". You'll be able to download a function I wrote called Is_Run32(). You simply pass the function the known portion of the application's title bar. If it returns 0 the application isn't running. If it's greater than 0 the application is running. This value is the window handle
Once you have the window handle, you can use the ShowWindow() API call to bring it to restore it to it's last size and postion:
DECLARE SHORT ShowWindow IN Win32API;
INTEGER hWnd, INTEGER nCmdShow
lnhWnd = Is_Run32('Whatever title bar')
IF lnhWnd > 0
= ShowWindow(lnhWnd, 9)
ENDIF
Once you determine if the application's running, there are a number of things you could do. Assign value to a form property that could be evaluated before certain processing took. You could use a loop based on the return value of Is_Run32(), but I wouldn't recommend it. It'd be too easy to get stuck in it.
As a side note, thanks to John for the kind words.
hth,
George
Ubi caritas et amor, deus ibi est