Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need wait state for a vfp program while a run /n completes
Message
From
27/03/2002 13:47:21
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Need wait state for a vfp program while a run /n completes
Miscellaneous
Thread ID:
00638010
Message ID:
00638010
Views:
76
Hi UTers,
I need to know when a program that I RUN /N from vfp is closed before I continue with my vfp code. When I "RUN /N emodel.exe" I find that vfp continues even though emodels.exe is still on the desktop. How do I develop a wait state within vfp so that I don't proceed until emodels.exe is closed. I can do it with word in the following way:

****************************************************************************

DECLARE LONG FindWindowA IN WIN32API STRING class, STRING title
DECLARE INTEGER SendMessage IN Win32API INTEGER HWND,INTEGER Msg, Short WParam, INTEGER LPARAM)

Declare short IsWindow in WIN32API integer
declare Sleep in win32API integer

oWord = Createobject('Word.Application')
* Pass the class name for Word - "OpusApp" to FindWindowA
oWordHandle = FindWindowA('OpusApp',NULL)
WITH oWord
.Documents.Add
.Visible=.T.
.Selection.InsertAfter ("This is a test.")
.Application.Activate && Activate Word.
ENDWITH
=INKEY(3) && Wait a couple seconds then close Word.

** =SendMessage(oWordHandle,16,0,0)

** loop until word closes
do while IsWindow(owordhandle)#0
=sleep(250)
enddo

** now that word is closed we can continue
***********************************************************************

** but this is not WORD and emodels.exe is not a server
** please review the code below and advise

= messagebox("you are in vfp Press OK to activate model program")

** get path to emodel Program on this computer
cemodel= c:\emodel\emodel.exe
cUniqueID = "123456"

If !File(cemodel)
= MESSAGEBOX("Sorry.... eCentricPractice could not locate GeoDigm emodel program.")
RETURN .f.
ENDIF

cCommandLine = "PATIENT_ID " + cUniqueID + " JPEG_ABO_ALL" && v_patients.cID

** WAIT WINDOW ccommandline
cRunLine = ["]+cemodel+["]+ " " + cCommandLine

WAIT WINDOW cRunLine TIMEOUT .3
RUN /n &cRunLine

* this is where I would like to test if emodel.exe is closed
= messagebox("You are back in vfp")
Next
Reply
Map
View

Click here to load this message in the networking platform