DispatchMessage(&msg);

This is a discussion on DispatchMessage(&msg); within the Windows Programming forums, part of the Platform Specific Boards category; what i heard is that DispatchMessage calls Windows..which in turn calls the WndProc...and in the WndProc there's a switch statment... ...

  1. #1
    samurai warrior nextus's Avatar
    Join Date
    Nov 2001
    Posts
    196

    DispatchMessage(&msg);

    what i heard is that DispatchMessage calls Windows..which in turn calls the WndProc...and in the WndProc there's a switch statment...
    switch(message)
    {
    case WM_CREATE:
    return 0;
    case WM_PAINT:
    return 0;
    etc....
    }
    well how does Windows know what handle to window it is?

  2. #2
    Registered User
    Join Date
    Feb 2003
    Posts
    76
    The handle to the appropriate window is found in the hwnd member of the MSG structure referenced by the call to DispatchMessage. The MSG structure also contains the message ID and two message parameters that DispatchMessage sends the window.

    DispatchMessage generally handles messages posted using the PostMessage function. If the hwnd member is NULL, DispatchMessage, I presume, does nothing.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21