How to get the PID of the process itself ?
Hello,
Could anyone please answer me a simple question ...
How to get the process ID of the VB application itself when it is started
(I need to use it for some timing problems) ? I can enumerate all
Windows and find it by name, but there is probably a simpler method.
Actually one more question: How to get a handle to a system window
by its Class Name ? There is always a system window associated with
Clipboard, its Class Name: CLIPBRDWNDCLASS. How to get a handle to it ?
I am able to do that first copying something to the clipboard and than call :
GetClipboardOwner(), but I need to get a handle to it before copying.
Is it possible ? When I enumerated all Desktop children, this system window is
not shown in the list.
Re: How to get the PID of the process itself ?
for the pID question, use GetCurrentProcessId
Re: How to get the PID of the process itself ?
Thanks a lot, I knew that it should be simple :)
As for my second question, of course, I could use
FindWindow(CLIPBRDWNDCLASS), but it gives a different handle than
I retrieve using Copy method.
It seems that there is more than one system window with such Class Name ...
How to enumerate them ?
Re: How to get the PID of the process itself ?
well i'm not really sure if that will solve your problem, but you could enumerate them using FindWindowEx:
VB Code:
Dim lhWnd As Long
Do
lhWnd = FindWindowEx(0&, lhWnd, "CLIPBRDWNDCLASS", vbNullString)
If lhWnd Then Debug.Print lhWnd
Loop While lhWnd