Page 1 of 2
FOXPRO TO XBASE++ CONVERSION
Posted: Fri Mar 03, 2017 11:48 pm
by unixkd
Hi Roger
How can I convert this Foxpro function to Xbase++ ?
FUNCTION IsExeRunning(tcName, tlTerminate)
LOCAL loLocator, loWMI, loProcesses, l 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
Thanks
Joe
Re: FOXPRO TO XBASE++ CONVERSION
Posted: Sat Mar 04, 2017 2:52 am
by Auge_Ohr
unixkd wrote:loProcesses = loWMI.ExecQuery([SELECT * FROM Win32_Process WHERE Name = '] + tcName + ['])
this was generated from my Xbase++ App.
it does include all Property so just take what you need.
... i wonder why you want to use WMI COM Interface

Express++ have
Code: Select all
FUNCTION DC_IsAppRunning( cClass, cTitle, cFile, lRestore )
Re: FOXPRO TO XBASE++ CONVERSION
Posted: Sat Mar 04, 2017 4:49 am
by unixkd
Hi Jimmy
The Process Class has :Terminate() Method, How can I use it
Re: FOXPRO TO XBASE++ CONVERSION
Posted: Sat Mar 04, 2017 11:35 am
by Auge_Ohr
unixkd wrote:The Process Class has :Terminate() Method, How can I use it
hm ... i can see "TerminationDate" ... but they are all Property no Method.
Re: FOXPRO TO XBASE++ CONVERSION
Posted: Sat Mar 04, 2017 1:15 pm
by unixkd

- WMISample.jpg (105.15 KiB) Viewed 25819 times
Hi Jimmy
Check the "execute a method" of WMI code creator as shown above and you will see the 6 methods exposed by object.
Thanks
Joe
Re: FOXPRO TO XBASE++ CONVERSION
Posted: Sat Mar 04, 2017 1:41 pm
by Auge_Ohr
unixkd wrote:Check the "execute a method" of WMI code creator as shown above and you will see the 6 methods exposed by object.
you are right but my Xbase++ WMI Generator does not know how to "detect" WMI Method ... only Property.
Re: FOXPRO TO XBASE++ CONVERSION
Posted: Sat Mar 04, 2017 1:56 pm
by rdonnay
If you need to kill a window you could use the TASKKILL command.
Re: FOXPRO TO XBASE++ CONVERSION
Posted: Sat Mar 04, 2017 2:14 pm
by unixkd
Hi Roger
The RunShell( '/IM Excel.exe', 'TaskKill.Exe' ) gives operating system error 2
I think the foxpro sample will give the desired result if it can be converted to Xbase++
Thanks.
Re: FOXPRO TO XBASE++ CONVERSION
Posted: Sat Mar 04, 2017 2:40 pm
by Auge_Ohr
try this Code to close Excel
Re: FOXPRO TO XBASE++ CONVERSION
Posted: Sat Mar 04, 2017 3:04 pm
by unixkd
Hi Jimmy
SendMessageA() not found in CLOSEIT
Thanks