Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
List of active processes with user
Message
 
À
28/06/2021 15:05:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
01681614
Message ID:
01681623
Vues:
43
>>Someone can suggest me a way to retreive the list of current processes for the current user ? And not all ?
>>I found code for the list, but i have problems while retreiving the owner...
>>
>
>Michele,
>
>You may adjust to your needs / context:
>
>
>CLEAR
>
>LOCAL Me AS String
>
>m.Me = UPPER(STREXTRACT(SYS(0), " # ", ""))
>
>LOCAL WMIService, AllProcesses, Process
>LOCAL Owner AS String
>
>m.WMIService = GETOBJECT("winmgmts:\\.\root\cimv2")
>
>m.AllProcesses = m.WMIService.ExecQuery("SELECT * FROM Win32_Process",,48)
>
>FOR EACH m.Process IN m.AllProcesses
>
>	m.Owner = SPACE(1024)
>
>	TRY
>		IF m.Process.GetOwner(@m.Owner) == 0
>			IF UPPER(m.Owner) == M.Me
>				? TEXTMERGE("<<m.Process.Name>> is owned by the logged user (<<m.Process.ProcessId>>)")
>			ELSE
>				? TEXTMERGE("<<m.Process.Name>> is owned by <<m.Owner>>")
>			ENDIF
>		ENDIF
>	CATCH
>	ENDTRY
>
>ENDFOR
>
The code works....but after some time...i have error 2 while trying to use getowner function... and so i can't get the owner and i can't understand my processes because i have the same error on all processes.....
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform