Thread: Question about WM_COMMAND

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    43

    Question about WM_COMMAND

    Hello,

    In a small Win32 game of mine, I am passing Windows messages to functions instead of handling them in my WndProc, and it works fine with messages like WM_MOUSEMOVE, but WM_COMMAND doesn't seem to work. Am I doing anything wrong?

    Code:
    if (Msg.message == WM_COMMAND)
       if (LOWORD(wParam) == ID_BUTTON)
          if (HIWORD(wParam) == BN_CLICKED)
             MessageBox(NULL, TEXT("Testing..."), TEXT("Test"), MB_OK);
    Thanks.

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Some messages are sent rather than posted, and will never be returned by GetMessage. More on this in the comments section of this page.

  3. #3
    Registered User
    Join Date
    Dec 2005
    Posts
    43
    Alright, thanks. I just used this instead:

    Code:
    case WM_COMMAND:
    	PostMessage(NULL, WM_COMMAND, wParam, lParam);
    	break;
    Last edited by Darklighter; 04-12-2007 at 03:24 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alice....
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 02:51 PM
  2. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 01:47 AM