Results 1 to 4 of 4

Thread: How to get the PID of the process itself ?

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    6

    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.

  2. #2

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    6

    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 ?

  4. #4
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    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:
    1. Dim lhWnd As Long
    2.  
    3. Do
    4.     lhWnd = FindWindowEx(0&, lhWnd, "CLIPBRDWNDCLASS", vbNullString)
    5.     If lhWnd Then Debug.Print lhWnd
    6. Loop While lhWnd

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width