Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Squeejee

I need help on using controls.

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

I am learning the windows api id my book does not do a good job at explaining controls. It says I need to create a ''dialog template'' an it gives me this as an example:
  
hDefPushbutton = CreateWindow(
                 _T("button"),
                 _T("OK"),
                 WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON,
                 100,
                 200,
                 30,
                 15,
                 hwnd,
                 (HMENU) IDOK,
                 hinstance,
                 NULL);
  
Now what does that all mean and where do I put that?

Share this post


Link to post
Share on other sites
Advertisement
You can either create buttons on the fly (meaning in the code) or you can make a template and call it, the way you code looks you are creating it in the code. Since this is a child window, it should probably go inside your main procedure code (WndProc most likely). Possibly under WM_CREATE (when a window is created, and you want to do specific things with the window, put code in the create section)
what this is doing:
    
// returning a handle to a window

hDefPushbutton = CreateWindow(
// this is the window class, "button" is a predefined class

// _T() macro i don't remember, might be unicode

_T("button"),
// text to appear on the button

_T("OK"),
// bits to set about the window, child, visible and default button

WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON,
// x coord to appear on screen

100,
// y coord to appear on screen

200,
// width of window

30,
// height of window

15,
// parent of window, of type HWND

hwnd,
// menu of a window, for a button i would use NULL

(HMENU) IDOK,
// instance of the program, used if more than one is running

hinstance,
// extra data u want to send along

NULL);


if i'm being too basic, or not answering your question, respond and i'll try again

edit - } instead of ] *stupid sticky shift*

Edited by - Skibum on November 5, 2001 12:33:25 PM

Share this post


Link to post
Share on other sites
Ok, I put:

    
WNDCLASS hDefPushbutton;
hDefPushbutton = CreateWindow(
_T("button"),
_T("OK"),
WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON,
100,
200,
30,
15,
hwnd,
NULL,
hinstance,
NULL);



when a WM_CREATE message appears, and it gives me an error saying '_T' is an undeclared identifier.

Edited by - Squeejee on November 5, 2001 1:18:27 PM

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!