C++ Win32 Button Help

Started by
1 comment, last by Matthew Shockley 13 years, 12 months ago
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...
If I asked you for a hundred dollars would the answer to that question be the same as the answer to this question?
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
Fate fell short this time your smile fades in the summer.
Thanks!
If I asked you for a hundred dollars would the answer to that question be the same as the answer to this question?

This topic is closed to new replies.

Advertisement