Jump to content
  • Advertisement
Sign in to follow this  
ender7771

Win32 API: Buttons!!!!

This topic is 4472 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

okay; this is copied from another post i made on another board: "Yeah- I got a question with the win32 api. Im trying to create a simple button on my main window: I take a gander at msdn for CreateWindow(...): lpClassName [in] Pointer to a null-terminated string or a class atom created by a previous call to the RegisterClass or RegisterClassEx function. ... The class name can also be any of the predefined system class names. For a list of system class names, see the Remarks section. Remarks: System Class: BUTTON So do I simply use "BUTTON" as the first parameter of CreateWindow()? I have tried that, and it says that "BUTTON" has not been defined, though it works if I make a resource for a dialog file. Im using DevC++ w/ mingw; is that why it isnt working?" Can someone please help me out? Any code examples, links, etc. would be "sehr nett".

Share this post


Link to post
Share on other sites
Advertisement
HWND button = CreateWindow(
"BUTTON", /* this makes a "button" */
"Class Options", /* this is the text which will appear in the button */
WS_VISIBLE | WS_CHILD,
5, /* these four lines are the position and dimensions of the button */
60,
105,
20,
hWnd, /* this is the buttons parent window */
(HMENU)IDB_CLASS_OPTIONS, /* these next two lines pretty much tell windows what to do when the button is pressed */
(HINSTANCE)GetWindowLong(insert, GWL_HINSTANCE),
NULL);

That is how you create a button. You could google "C++ Win32 tutorials" and things like that and I'm sure loads of good info would come. Also, people don't take kindly to double posting, but at least your honest about it...

Hope this answers your question

Share this post


Link to post
Share on other sites
Thank you so much! I did not realize I had to put the button in quotes, but now that makes so much sense!

As for the double posting, it wasnt on gamedev, but another forum :).

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!