Thread: GetWindowThreadProcessId

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    44

    Question GetWindowThreadProcessId

    Can anybody help me with this please:

    GetWindowThreadProcessId


    The format is as follows:

    Syntax

    DWORD GetWindowThreadProcessId(HWND hWnd, LPDWORD lpdwProcessId);


    Parameters

    hWnd
    [in] Handle to the window.

    lpdwProcessId
    [out] Pointer to a variable that receives the process identifier. If this parameter is not NULL, GetWindowThreadProcessId copies the identifier of the process to the variable; otherwise, it does not.


    Return Value

    The return value is the identifier of the thread that created the window.

    Although, I think it can, but just to make sure...can the hWnd psased in, be a handle to a toolbar?

    Also, what is the difference between the 2nd paramater and the return value??? (in simplish terms is possible!).


    Thank you very much!
    Uni

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    If the handle is a standard HWND then it should work.

    The return is the id of the thread that runs the window....the 2nd param is the id of the process (think of a process as a loaded instance of an application - that process can then have multiple threads running windows or other tasks)

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    76
    It should work with any window, including toolbars. The second parameter, which is a DWORD pointer, receives the window's process ID. The return value is the window's thread ID.

    You should have figured this out in the documentation.

  4. #4
    Registered User
    Join Date
    May 2003
    Posts
    44
    Woaw!!!! You people seriously move quick

    Thanks Fordy. Explaination was a treat

    poccil - I just couldn't get my head around it, although after Fordys explaination and yours, it seems kinda easy now


    Thanks guys for your comments!
    Uni

Popular pages Recent additions subscribe to a feed