Jump to content
  • Advertisement

Archived

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

Ademan555

GetOpenFileName() givin me one hell of a time

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

You know, those things you see every tiem you go to save or open a file? They're so "standard issue" i cant help but assume theres some pre-made class or function that takes care of that, am i wrong? if not, whats it called? -Dan Yes I realize im a n00b... [edited by - Ademan555 on February 7, 2004 9:06:16 PM] [edited by - Ademan555 on February 8, 2004 4:31:01 AM]

Share this post


Link to post
Share on other sites
Advertisement
They''re part of the common dialog box library. You can access them with the GetOpenFileName() or GetSaveFileName() Win32 functions.

Share this post


Link to post
Share on other sites
I used the function GetOpenFileName() and absolutely nothing happened... i have WIN32_LEAN_AND_MEAN defined, though it still didnt show without it defined, and i have windows.h included, along with commdlg.h any clue whats wrong?

Share this post


Link to post
Share on other sites
I''m unclear here. Did you program even actually compile and link? Assuming that it did, what does CommDlgExtendedError() say?

Share this post


Link to post
Share on other sites
Didnt check for an error, ill do that... it does compile, and it does link, i can run the program just fine, but it doesnt show up...

Share this post


Link to post
Share on other sites
CommDlgExtendedError() returned a value of 0x00000001 now... i looked into it, and apparently... a value of 0x0001 is CDERR_STRUCTSIZE ... should i assume thats the error? (well im gonna look into that anyways)

edit: fixed, thanks a lot, apparently i should have looked into the OPENFILENAME struct more, you need to give it the sizeof(OPENFILENAME) in the lStructSize member.... (for anyone else who has the same problem)

[edited by - Ademan555 on February 7, 2004 10:47:05 PM]

Share this post


Link to post
Share on other sites
When calling Windows functions, ALWAYS do these two things:

1) ALWAYS memset the entire struct to 0.
2) If the struct has a size field, set it to sizeof(the struct).

Share this post


Link to post
Share on other sites
So i set the size member to sizeof(OPENFILENAME), and i set the nMaxFile to MAX_PATH what now? the function doesnt return an error ive checked... and yet.... the lpstrFile (which should be the file path) is NULL... what gives?

OPENFILENAME Path;

ZeroMemory(&Path, sizeof(OPENFILENAME));
Path.lStructSize = sizeof(OPENFILENAME);
Path.nMaxFile = MAX_PATH;

GetOpenFileName(&Path);

and when i check...

Path.lpstrFile .... its null....

any ideas?

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!