Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is VFP Running?
Message
 
 
To
08/10/2009 20:12:32
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01428120
Message ID:
01428377
Views:
49
Karen,

Did you try

lcExeName = "VFP9.exe" without a path?

>Hi Sergey - your program below works on programs that are running on the same computer as vfp - (very imprssive feat btw)
>i am trying to shut down the vfp on a neworked computer and while i get the first [.t.] which shows that your program recognizes the secondary computer and that vfp is running on it - when your program moves into phase 2 and attempts to shut down the vfp program i get an error message as shown here. is there an easy fix here or is this program not meant for network applications ?
>
>error message:
>Error: Number: 1429
>Message: OLE IDispatch exception code 0 from SWbemObjectSet: Invalid query ..
> Parameter: Invalid query
> Work Area: SWbemObjectSet
>
>your program with link to secondary computer.
>lcExeName = " \\name1\Program Files\Microsoft Visual FoxPro 9\vfp9.exe"
>* Is EXE running
>? IsExeRunning(lcExeName)
>
>
>* Terminate EXE if it's running
>? IsExeRunning(lcExeName, .T.)
>
>RETURN
>
>FUNCTION IsExeRunning(tcName, tlTerminate)
>LOCAL loLocator, loWMI, loProcesses, loProcess, llIsRunning
>loLocator = CREATEOBJECT('WBEMScripting.SWBEMLocator')
>loWMI = loLocator.ConnectServer()
>loWMI.Security_.ImpersonationLevel = 3 && Impersonate
>
>
>loProcesses = loWMI.ExecQuery([SELECT * FROM Win32_Process WHERE Name = '] + tcName + ['])
>llIsRunning = .F.
>IF loProcesses.Count > 0
> FOR EACH loProcess in loProcesses
> llIsRunning = .T.
> IF tlTerminate
> loProcess.Terminate(0)
> ENDIF
> ENDFOR
>ENDIF
>RETURN llIsRunning
>
>Error: Number: 1429
>Message: OLE IDispatch exception code 0 from SWbemObjectSet: Invalid query ..
> Parameter: Invalid query
> Work Area: SWbemObjectSet
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform