Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Capture error from external app
Message
 
 
To
06/10/2004 10:51:30
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00949207
Message ID:
00950179
Views:
25
You can use FindWindow Win API to check if Error Dialog exists and sent keystrokes with WSH.
DECLARE Long FindWindow IN WIN32API STRING @lpClassName, STRING lpWindowName
oShell = Createobject("wscript.shell")
lcWinTitle = "<Error Window Title>"
...
  IF FindWindow(0, lcWinTitle)
    oShell.AppActivate(lcWinTitle)
    oShell.SendKeys("...")
    ...
  ENDIF
...
For the list of keys see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthsendkeys.asp.




>
>I have an application (build with vfp8) wich work toghether with other external application (v1.exe). First called second (v1.exe) with param (a video file) and second process param and create a file text with tags of file. Sometime second give a external windows error
>
>"v1.exe has encountered a problem and need to close ...".
>
>Some code for detail:
>
>LOCAL lcVideoFile
>lcVideoFile = ALLT(Thisform.GrdDetail.txt_movie.Value)
>lcVideoFile = '"'+lcVideoFile+'"'
>
>ERASE (sys(2023)+"/vidview.txt")
>   SET SAFETY OFF
>   SET TEXTMERGE ON TO "C:\v1.bat" noshow
>   \CD\
>   \CD C:\CFIND
>   \v1.exe <<lcVideoFile>> > <<alltrim(SYS(2023))>>\vidview.dat
>   \REN <<alltrim(SYS(2023))>>\vidview.dat vidview.txt
>   SET TEXTMERGE TO
>   SET TEXTMERGE OFF
>   SET DEFA TO SYS(2023)
>   SET SAFETY ON
>   RUN/n C:\v1.bat
>   ****************This.runapp('C:\MEDIAINFO.BAT','','HIDDEN')
>   WAIT WINDOW "Gathering User Detail" NOWAIT
>   DO WHILE FILE(ALLT(SYS(2023))+"\vidview.txt") = .F.   && wait for file to be created
>      * in this loop received external error
>      * i choose DON'T SEND for external message error
>      * AND MY App(VFP App) REMAIN IN THIS LOOP
>   ENDDO
>   WAIT CLEAR
>
>SET DEFA TO (VDEF)
>RETURN
>
>I wish to capture this external errors and processing internal (in rutine of vfp); and i kill external process what remaining in windows task manager (v1.exe).
>GetLastError() ???
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform