Jump to content
  • Advertisement

Archived

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

Muzlack

win api question

This topic is 5984 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''m totally unfamiliar with the win api except to get a window up and running for my directX game. I want to ask the user for a map making program i''m making a file they would like to open up. Is there a way that I can make a simple dialog box (it doesn''t even need to have text on it) that has a text box for the user to type in a filename? or, a way to make my own scanf command? Sponge Factory --Muzlack

Share this post


Link to post
Share on other sites
Advertisement
Well, about the simplest you''re gonna get is to make a dialog box template in the resource editor and then call the DialogBox function.

Then, handle the OK click and grab the text with GetDlgItem (or GetDialogItem, dun remember) and GetWindowText

Share this post


Link to post
Share on other sites
quote:
Original post by daerid
Then, handle the OK click and grab the text with GetDlgItem (or GetDialogItem, dun remember) and GetWindowText



GetDlgItem() + GetWindowText() = GetDlgItemText() =)

Anyway, if you just want the dialog box for the simple purpose of collecting a string and then it goes away then using a dialog resource is very easy and time saving. Winprog has some tutorials on dialog boxes and basic Win32 API.



I will not make a list of links... I will not make a list of links... I will not make a list of links...
Invader''s Realm

Share this post


Link to post
Share on other sites
quote:
Original post by Muzlack
what should the second argument of getdlgitem be?

The item identifier as specified in resource.h. While in your resource editor, be sure to alias the control (button, textbox, whatever) with an ID (something like IDC_USERNAME). MSVC will define this as being equivalent to a particular integer and you can use that symbol (IDC_blah) in your dialog code after including resource.h.

Share this post


Link to post
Share on other sites
The id of your control. Frequently dialog items are given id's like ID_STATIC1 or ID_MYBUTTON etc. That is the id you are supposed to use.

*Bah! Beaten!



I will not make a list of links... I will not make a list of links... I will not make a list of links...
Invader's Realm

[edited by - Invader X on July 1, 2002 1:02:01 AM]

Share this post


Link to post
Share on other sites
Also, when you create a resource in VC++, it automatically creates a file "resource.h" in your project space. Each control on your dialog is given a unique ID and inside resource.h are the name of those controls and their IDs. Add

#include "resource.h"

to your main program file, and you can then use those controls by name instead of ID #.

Sorry, I just restated what Olu said

http://roninmagus.hopto.org

[edited by - Ronin Magus on July 1, 2002 11:13:30 AM]

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.

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!