Tuesday, 15 March 2011

process - how to identify application instance name along with its user in vb.net 3.5? -


I am using the code given below to identify the frequency of the application, if we want to check who This will be the code for some user using this application

  Function PrevInstance () Boolean, then Ubound (Diagnostics.Process.GetProcessesByName (Diagnostics.Process.GetCurrentProcess.ProcessName)) & gt; In? 0 or else it is true Return Return false end then end function  

My user needs to open the application should display the pop-up message "Application already opened" like this Then tries.

Please advise ... abhay

thanks many people .... my The problem with the solution is as follows:

  & gt; Function Previous Instruction () Boolean & gt; If UBound (Diagnostics.Process.GetProcessesByName (Diagnostics.Process.GetCurrentProcess.ProcessName)) & gt; & Gt; 0 then & gt; Dim CurUser = GetProcessOwner as Boolean (Diagnosis. Process.GetCurrentProcess.ProcessName) & gt; Return CurUser & gt; Other & gt; Return false & gt; End & G; End Function  
function GetProcessOwner (ByVal ProcessName As String) Boolean Dim boolVal Boolean Dim CurUserName string in as dim CountInstance integer CountInstance = 0 CurUserName = System.Environment As
. User Name Dim SelectQuery SelectQuery = Due Finder in the form of New SelectQuery ManagementObjectSearcher = New ManagementObjectSearcher (selectQuery) in the form of System.Management.ManagementObjectCollection y = yer = searcher ('+ ProcessName +' .exe "" where from Win32_Process = Select * '' '). As a proc for ManagementObject y in the form of slow (1) string proc.InvokeMethod ("GetOwner", CTYPE (s, object ()) go dim n string = proc ("name"). ToString () if n = Process name & amp; ".xa" then if s (0) = calculate the queueuser name = difference = count = 1 if calculation intensities & gt; 1 then the Bool Val = True and End End and if the next return boolVal End function  

I have called its predecessor () in my form_load () and it is completely doing work.


No comments:

Post a Comment