1. Yuri Denshchik
  2. PowerBuilder
  3. Thursday, 20 July 2017

I need to get some information about current Window Processes

We used to call VBScript to get that. After we migrate app to 64-bit it is impossible to call VBScript using MSScriptControl.ScriptControl ActiveX. 

We are searching for alternatives. Luckly WbemScripting.SWbemLocator ActiveX is available on 64-bit and we partially can get it to work:

OleObject locator,service,props
String ls_query 
int li_cnt, ret, i

ls_query ="Select ProcessID from Win32_process where name = '" + as_app + "'"
locator = CREATE OleObject
ret = locator.ConnectToNewObject("WbemScripting.SWbemLocator");
service = locator.ConnectServer();
props = service.ExecQuery(ls_query);
li_cnt = props.count();

So far so good. Now we need to iterate through props for details. In VBScript it'd look like
For Each prop In props ... Next
Could someone advise how to iterate through that collection with PowerBuilder?

Thank you,




Accepted Answer
René Ullrich Accepted Answer Pending Moderation

There is a method "ItemIndex" you can call.

FOR ll_i = 1 TO ll_count

    prop = props.ItemIndex(ll_i - 1)


There are no comments made yet.
  1. Friday, 21 July 2017
  2. PowerBuilder
  3. # Permalink

There are replies in this question but you are not allowed to view the replies from this question.