• Advertisement
Sign in to follow this  

C++ Win32 Button Help

This topic is 2825 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have created a button with this code:
HWND Button1 = CreateWindow(L"Button", L"Show Syntax",
				WS_BORDER | WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
				0, 0, 100, 30, hWnd,
				NULL, NULL, NULL);
It compiles and shows up on the screen, but how do I tell when the users clicks this button? Any help please...

Share this post


Link to post
Share on other sites
Advertisement
A button is a child window to the window you created it in. It will send it's parrent a WM_COMMAND message. In the WM_COMMAND case you can check who is sending it, lParam is the child window handle...you can also use this to get the ID of the window), or use the HIWORD of wParam, which is the child window ID. The LOWORD of wParam is the notification code the button sends...for example if it got clicked or got focus etc. Check here: http://msdn.microsoft.com/en-us/library/bb775941%28VS.85%29.aspx

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement