- Daniel Mullings
- PowerBuilder
- Friday, 11 June 2021 09:23 PM UTC
Good day.
This is the code in my function:
int num, ret, i
long pid
String ls_query, ls_name
Any process
ls_query = 'select * from Win32_Process where name = "appname.exe"'
locator = CREATE OleObject
ret = locator.ConnectToNewObject("WbemScripting.SWbemLocator");
service = locator.ConnectServer();
props = service.ExecQuery(ls_query);
num = props.count()
pid = props.processid
Messagebox("of_check_sp_running", "count = "+ string(num) + " and pid = "+ string(pid))
return num
num comes back with 0 if appname.exe is not running and > 0 when one or more appname.exes are running.
But I'm looking to get the processid, but it keeps crashing.
Googled and have not found anything that works.
My goal is to download a self extracting install app that will update the current running app.
So, if app123_servicepack.exe is running (because I just downloaded it from a website from appname.exe), terminate appname.exe using similar script above prior to clicking install on app123_servicepack.exe. I terminate using name in win32_processes, but it kills appname.exe and app123_servicepack.exe as well.
I'm thinking I can terminate appname.exe by the processid and it will hopefully not terminate app123_servicepack.exe as well.
Thanks for any help anyone can provide.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.