Sign in to follow this  
Matthew Shockley

C++ Win32 Button Help

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
BrickInTheWall    150
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this