HWND Button1 = CreateWindow(L"Button", L"Show Syntax",
WS_BORDER | WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
0, 0, 100, 30, hWnd,
NULL, NULL, NULL);
C++ Win32 Button Help
I have created a button with this code:
It compiles and shows up on the screen, but how do I tell when the users clicks this button? Any help please...
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement