win32 Tasklist usage

Hello,
I’d be grateful if somebody could show me how to deploy the shell Tasklist for win32. I tried this:

dim sh as new shell
sh.execute “Tasklist”
if instr(sh.result, “myApp.exe”) > 0 then
//do something
end if

but it doesnt work. Thanks,
Carlo

This code works fine in a simple console app when searching for the same app:

dim mysh as Shell = new Shell
mysh.Mode = 0
mysh.Execute(“tasklist”)

if mysh.Result.InStr(app.ExecutableFile.Name) > 0 then
print(“Found”)
Else
Print(“Not found”)
end if

Regards.

[quote]dim mysh as Shell = new Shell
mysh.Mode = 0
mysh.Execute(“tasklist”)[/quote]

Same result: … runtime error; … Common plugin ccp:5739; …cant find plugin method shell_init

May be the code is intended only for consolle apps.

Hi Carlo,

where you are running the above code?

open event of app

The above code runs fine in the App.Open event of a desktop app.
Of course you must remove the “print ()” method that it’s unavailable in a desktop app.
My setup: Windows 8.1 x64 with Xojo 2015r2.2.

[quote=198376:@Carlo Rubini]Same result: … runtime error; … Common plugin ccp:5739; …cant find plugin method shell_init

May be the code is intended only for consolle apps.[/quote]

Which version of Xojo/RB are you working with ? Under which version of Windows ? I suppose the error you report happens in the IDE and stops execution, right ? Is it the exact message ? This kind of error is absolutely not normal. It looks as if your version is corrupted or something.

I tried the code in the App.Open event and it works perfectly.

What a shame! Since I work on a Mac and test win32 apps thru a pendrive, I had not copied the new libraries, but kept the ones of the previous builds.
Thanks, Carlo