Jump to content
  • Advertisement
Sign in to follow this  
dave

Win32 Question

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

Hi, Venturing into the 'wonderful' world of win32 programming and am stuck. I have been working through some tutorials and cant find any info on what i want. I have been learning how to create menus dialogues forms and cursors etc. All the examples till now have had a big white client area but what i want to do is put stuff in there. For no i want just one button and one textbox. Question 1: How do i do this, put buttons in the client area? Question 2: Once they are there how do i read the on-click event? Thanks ace

Share this post


Link to post
Share on other sites
Advertisement
theForgers's Win32 API Tutorial

#define BUTTON 4000

CreateWindowEx(WS_EX_WINDOWEDGE, "BUTTON", "Button Text", WS_CHILD, 0, 0, 100, 25, hWnd, (HMENU)BUTTON, hInst, NULL);

switch(msg)
{
case WM_COMMAND:
switch(LOWORD(wParam))
{
case BUTTON:
CallSomeOnClickFunction();
break;
}
break;
}

Share this post


Link to post
Share on other sites
Ok, but where do i put it?

It seems that with win32 you have chunks of message handling code everywhere?

If i want to create a complicated window do i just have to do lots and lots of these, in objects.


ace

Share this post


Link to post
Share on other sites
You could put it in WM_CREATE or just before you start your message loop. You have to make a control if you want to create them at runtime. Or if you just want a predifined form you have to make a dialog in visual studio, you just make a resource then you can drag buttons etc. onto the form, then you could make a complicated form.

Share this post


Link to post
Share on other sites
Right ok,

Do you know how to make a dialogue take the place of the entire client area?

ace

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If you want to tear apart an app, you can tear apart the examples on http://www.codeproject.com/library/DWinLib.asp. There is also a little about what is needed to objectivize capturing a button click in the writeup. Specifically, look into the WinButton.cpp file. The message handling for the button clicks begins in the WinBaseO::wCommand function, which handles the WM_COMMAND message, as hinted at above.

David

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
As far as a dialog taking the place of the client area, I've never played with that. I've simply created the form I wanted, with the inputs and objects I wanted, where I've wanted them, and done any other drawing necessary.

David

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!