Search code examples
c++winapiuser-interfacewindow

C++ -- Win32 API, GUI stuff


I've been messing with Win32 API for abit, and I've got a question regarding the GUI functions.

How does one handle user input that is not managed through popup windows? I've been reading http://www.winprog.org/ but right when the interesting features comes -- lesson9 -- it becomes more abstract and I'm not sure how to do it. Basically what I am after is the user to write input in two windows and then press a button to send a message that the content of the input is to be processed. I think the input windows would be some EDIT-class windows and the input BUTTON-class but that's about it.

Any ideas? I'm sure it's simple, it's just makes me want to rip my hair of in native code :p

Cheers


Solution

  • You're correct, you want and EDIT control which is more commonly known as a TextBox and a BUTTON class which is a command button.

    To get the the input the Button will send a WM_COMMAND message to its parent window with a BN_CLICKED in the wParam high word. You can identify the particular button from the hWnd you get in that message.

    After that you'll need to post a WM_GETTEXT to the edit control to retrieve the users input.

    This is all from memory so I highly recommend looking up the msdn pages before you code.