Win32 Question

Started by
27 comments, last by GameDev.net 18 years, 8 months ago
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
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;
}
If you insist on saying "DUH", try to make a post that makes a little more sense
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
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.
If you insist on saying "DUH", try to make a post that makes a little more sense
Right ok,

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

ace
Sure u dont know ow GD Crew, im really stuck with this [sad]

ace
LoadDialogEx or something like that.
Buy Pretzold's book if you want a good Win32 primer.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
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
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
Programming Win32 UI without Petzold's book is an exercise in futility.
--God has paid us the intolerable compliment of loving us, in the deepest, most tragic, most inexorable sense.- C.S. Lewis

This topic is closed to new replies.

Advertisement