Sign in to follow this  

Noob in need _

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

Hey, I need to know how to use controls. (NO! Not Keyboards or Joysticks!) You know, like edit boxes and list boxes. I've seen them everywhere, but no tutorials are basic enough. I don't know what to link, include, or anything that simple. Anyway, can someone point me in the direction of a good tutorial? (And maybe answer my questions?)

Share this post


Link to post
Share on other sites
Yesh, it's c++. I did go to ths site to try to get help: http://winprog.org/tutorial/controls.html
but when I tried it out, the compiler (MSVC) didn't know what IDC_TEXT was. Looking at the source code, it seems the author of the tutorial defined it himself.

I figure that I would do my own work; I would not use other people's source code so I could learn more :


Are there any other free tutorials that DON'T rely on their own definitions (or whatever) to work? Or am I just missing something?

Share this post


Link to post
Share on other sites
I have to agree with RaptorZero...the forgers win32 api tutorial (online or PDF) is the place to look.

Are you having trouble creating a Windows Application? What IDE are you using? Have you tried DEV-C++. It's free and pretty powerful.

Good luck.

Share this post


Link to post
Share on other sites
I did try devC, but I couldn't find support for resources, so I got Microsoft Visual C++.

Like I said, I did look at theForger's tutorial, but (also as I said :P) the code they used mentions IDC_TEXT, but my compiler doesn't recognize it. I looked at the source code used in the tutorial, but it seems IDC_TEXT was defined by theForger. I just need to know why he defined it (and everything else he defined) the way he did. Or a different tutorial would be okay :)

Share this post


Link to post
Share on other sites
I may be wrong as I dont do much win32 programming in c++, but IDC_TEXT looks like it just refers to a textbox, and you can probably define it as whatever you want, as long as its not the same as another control.

Edit:
In other words, you could have something like this:
#define IDC_TEXT 100
#define IDC_TEXT2 101
#define IDC_TEXT3 102


That would let you have 3 textboxes, and the numbers apparently tell the win32 api which one you are refering to.

Share this post


Link to post
Share on other sites
Quote:
Original post by Deus Ex Otium
I did try devC, but I couldn't find support for resources, so I got Microsoft Visual C++.

Like I said, I did look at theForger's tutorial, but (also as I said :P) the code they used mentions IDC_TEXT, but my compiler doesn't recognize it. I looked at the source code used in the tutorial, but it seems IDC_TEXT was defined by theForger. I just need to know why he defined it (and everything else he defined) the way he did. Or a different tutorial would be okay :)

#define commands (when not being used to define a macro) are usually used to give an alias for a constant. When working with Win32 controls, you supply the system with ID numbers so that when you recieve a message saying a button was pressed, you can check the ID number and find out which one. You could just pick a number, say 107, and say that is the ID for a given control. However, this would make your code confusing and you would probably forget which numbers were for which controls. The solution is the #define command.
#define IDC_EDIT 107
You put that line at the top of an appropriate source file and then whenever you want the ID for your edit control, you type IDC_EDIT instead of 107. It makes the code more readable, and also allows you to change the value of the edit control's ID just by changing one line. There is nothing wrong with using #define commands; everyone does it. However, if you are alergic to them or something, for this specific usage you can replace the #define directive with const int, like this:
const int IDC_EDIT 107;
That does essentially the same thing, but in terms you might find a bit easier to understand.

Share this post


Link to post
Share on other sites
Thanks for the help, guys. (God, I love this community)

I thought I was missing a lib or header file or something... Yeah.

Share this post


Link to post
Share on other sites

This topic is 4673 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this