Hello,
When a folder is shared, is there a function to get all the users that are using a file?.
Thank you.
#Include "FiveWin.ch"
//-----------------------//
Function Main()
MsgList(GetExeUsers(cFileName( HB_ARGV( 0 ) )))
Return NIL
*------------------------------------*
FUNCTION GetExeUsers(cExe )
*------------------------------------*
Local oLoc,oWmi
Local oList, oProc
Local cUser, cDomain
Local aList := {}
oLoc:= CreateObject( "wbemScripting.SwbemLocator" )
oWmi:= oLoc:ConnectServer()
IF !Empty(oWmi)
oList := oWmi:ExecQuery( "select * from Win32_Process where Name = '" + cExe + "'" )
FOR EACH oProc IN oList
IF ( oProc:GetOwner( @cUser, @cDomain ) ) == 0
cUser = cDomain + "\" + cUser
IF AScan( aList, cUser ) == 0
AAdd( aList, cUser )
ENDIF
ENDIF
NEXT
ENDIF
RETURN aList
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 102 guests