Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need wait state for a vfp program while a run /n complet
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00638010
Message ID:
00638022
Views:
27
Check out file #9477 in the downloads.

HTH

Dan

>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")
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform