Page 2 of 2

Re: FOXPRO TO XBASE++ CONVERSION

Posted: Sat Mar 04, 2017 4:44 pm
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

Re: FOXPRO TO XBASE++ CONVERSION

Posted: Sun Mar 05, 2017 5:56 am
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)

Re: FOXPRO TO XBASE++ CONVERSION

Posted: Fri Mar 10, 2017 7:54 am
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.

Re: FOXPRO TO XBASE++ CONVERSION

Posted: Fri Mar 10, 2017 10:20 am
by bwolfsohn
Steffen,

Thanks for the example...

It's good to see you on this board...

Re: FOXPRO TO XBASE++ CONVERSION

Posted: Fri Mar 10, 2017 11:49 pm
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