FOXPRO TO XBASE++ CONVERSION

Xbase++ 2.0 Build 554 or later
Message
Author
User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: FOXPRO TO XBASE++ CONVERSION

#11 Post by Auge_Ohr »

unixkd wrote:SendMessageA() not found in CLOSEIT
:?: :?: :?:
it is on Top

Code: Select all

DLLFUNCTION SendMessageA( nHwnd, nCmd, wParam, lParam) USING STDCALL FROM USER32.DLL
greetings by OHR
Jimmy

Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: FOXPRO TO XBASE++ CONVERSION

#12 Post by Victorio »

"The RunShell( '/IM Excel.exe', 'TaskKill.Exe' ) gives operating system error 2"

I am closing application with :
RunShell('/F /IM ' + "someapp.exe",'C:\windows\system32\TaskKill.Exe',.t.,.f.)
this works for me,

and work also with acrobat :
RunShell("/F /IM "+nazovacrobat,'C:\windows\system32\TaskKill.Exe',.f.,.t.)

where nazovacrobat is full path to Excel application :
cestapdfview:=strtran(DC_Regquery(HKEY_CLASSES_ROOT,"Software\Adobe\Acrobat\Exe"),["])
nazovacrobat:=alltrim(substr(cestapdfview,rat("\",cestapdfview)+1,len(cestapdfview)-rat("\",cestapdfview)))
(this modification of path to acrobat is not optimalized, can write simplest)

steffen.pirsig
Posts: 1
Joined: Thu Mar 09, 2017 12:28 pm

Re: FOXPRO TO XBASE++ CONVERSION

#13 Post by steffen.pirsig »

Hi,

use plain Xbase++ 2.0, read the docs, take your FoxPro code and translate it 1:1 to Xbase++. I have done that with your code as shown below. Of ocurse i did some simplification - like hard coding notepad.exe. But it works:

#include "activex.ch"
PROCEDURE Main()
LOCAL oWMI, colItems
LOCAL aItem, bAdder,j

oWMI := CreateObject( "WbemScripting.SWbemLocator" ):ConnectServer("Localhost", "Root\CIMv2")
colItems := oWMI:ExecQuery("select * from Win32_Process where name='notepad.exe'",,48)

aItem := {}
bAdder := {|oService,n| AADD(aItem, oService )}
ComEvalCollection(colItems, bAdder )

FOR j:=1 TO Len(aItem)
aItem[j]:terminate(0)
NEXT

oWMI:Destroy()
RETURN

Bottom line here is:
1.) In FoxPro a "." is used as the send operator in Xbase++ the ":" is the send operator
2.) In FoxPro the Com-Collection (colItems) can be iterated using the FOREACH statement, in Xbase++ you need to transform the collection into an array using ComEvalCollection().

These are the primary differences and then it works.

regards
Steffen F. Pirsig
Alaska Software Inc.

bwolfsohn
Posts: 648
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: FOXPRO TO XBASE++ CONVERSION

#14 Post by bwolfsohn »

Steffen,

Thanks for the example...

It's good to see you on this board...
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

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

Re: FOXPRO TO XBASE++ CONVERSION

#15 Post by unixkd »

Wa oo

Steffen !!! Welcome to this forum. The busiest and the most vibrant and resourceful Xbase++ forum on the planet earth. Hl discover yourself in no distance future. Roger is God sent and doing a great job for our eXpress++ family.

Thanks for your contribution.

Joe

Post Reply