Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Returning a Process ID


Message #1 by "Michael Findlay" <michaelgfindlay@h...> on Mon, 26 Nov 2001 13:17:58
> Is there a way to gain the Process ID and use it in my VB code?  I need 
to 
> give a resource a unique name between processes so am looking for an 
> equivalent to C++'s "_getpid".
> 
> Thanks in advance....

Public Declare Function GetCurrentProcessId Lib "kernel32" _ 
Alias "GetCurrentProcessId" () As Long


GetCurrentProcessId

The GetCurrentProcessId function returns the process identifier of the 
calling process. 

DWORD GetCurrentProcessId(VOID);
 
Parameters
This function has no parameters. 

Return Values
The return value is the process identifier of the calling process. 

Remarks
Until the process terminates, the process identifier uniquely identifies 
the process throughout the system. 

  Return to Index