FOXPRO TO XBASE++ CONVERSION

Xbase++ 2.0 Build 554 or later
Message
Author
User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

FOXPRO TO XBASE++ CONVERSION

#1 Post 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

User avatar
Auge_Ohr
Posts: 1406
Joined: Wed Feb 24, 2010 3:44 pm

Re: FOXPRO TO XBASE++ CONVERSION

#2 Post 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.
Win32_Process.zip
WMI Source
(1.37 KiB) Downloaded 893 times
... i wonder why you want to use WMI COM Interface :?:
Express++ have

Code: Select all

FUNCTION DC_IsAppRunning( cClass, cTitle, cFile, lRestore )
greetings by OHR
Jimmy

User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

Re: FOXPRO TO XBASE++ CONVERSION

#3 Post by unixkd »

Hi Jimmy

The Process Class has :Terminate() Method, How can I use it

User avatar
Auge_Ohr
Posts: 1406
Joined: Wed Feb 24, 2010 3:44 pm

Re: FOXPRO TO XBASE++ CONVERSION

#4 Post 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.
greetings by OHR
Jimmy

User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

Re: FOXPRO TO XBASE++ CONVERSION

#5 Post by unixkd »

WMISample.jpg
WMISample.jpg (105.15 KiB) Viewed 23580 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

User avatar
Auge_Ohr
Posts: 1406
Joined: Wed Feb 24, 2010 3:44 pm

Re: FOXPRO TO XBASE++ CONVERSION

#6 Post 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.
greetings by OHR
Jimmy

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: FOXPRO TO XBASE++ CONVERSION

#7 Post by rdonnay »

If you need to kill a window you could use the TASKKILL command.
The eXpress train is coming - and it has more cars.

User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

Re: FOXPRO TO XBASE++ CONVERSION

#8 Post 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.

User avatar
Auge_Ohr
Posts: 1406
Joined: Wed Feb 24, 2010 3:44 pm

Re: FOXPRO TO XBASE++ CONVERSION

#9 Post by Auge_Ohr »

try this Code to close Excel
Attachments
CLOSEIT.ZIP
Xbase++ Source
(1.08 KiB) Downloaded 876 times
greetings by OHR
Jimmy

User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

Re: FOXPRO TO XBASE++ CONVERSION

#10 Post by unixkd »

Hi Jimmy

SendMessageA() not found in CLOSEIT

Thanks

Post Reply