"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)
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)
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.
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
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.