Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determine all current Win process
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01064064
Message ID:
01064480
Views:
260
BTW, you don't have to pass any parameters to GetOwner() to determine if process has an owner.
 * See if owner can be determined
  Return = objProcess.GetOwner()
>I just discovered it and was going to post my finding. You are way too fast Sergery...< s >
>Thanks again.
>
>>You've to pass output parameter by reference. However doing so generates an error when owner cannot be determined. Below is modified code that works.
For Each objProcess in colProcesses
>>	strNameOfUser = REPLICATE(CHR(0),256)
>>    * See if owner can be determined
>>    Return = objProcess.GetOwner(strNameOfUser)
>>    If Return <> 0 Then
>>        ? "Could not get owner info for process " + objProcess.Name + CHR(13) + "Error = " + STR(Return)
>>    Else
>>        * Get Owner
>>        Return = objProcess.GetOwner(@strNameOfUser)
>>
>>        IF objProcess.name = "WINWORD"
>>        	SET STEP ON
>>        ENDIF 	
>>        ? "Process " + objProcess.Name + " is owned by " + "\" + strNameOfUser + "."
>>    EndIf
>>Next
>>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform