Jump to content
  • Advertisement
Sign in to follow this  
BNY

GetOpenFileName (Windows API)

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

For a map editor, I need to use the Open File common dialog box. Seems to work fine, but when I use the dialog box and select My Computer, the list pane shows nothing, yet I am able to select disk drives and folders from the drop down list at the top. I couldn't find anything in documentation or online help about why it isn't showing my disk drives, so I suppose this is a good place to ask. This is my filter and set of flags for the OPENFILENAME structure:
openFilename.lpstrFilter = TEXT("Images (.bmp .dib .jpg .png .tga)\0*.bmp;*.dib;*.jpg;*.jpeg;*.png;*.tga\0\0");
openFilename.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;


Also, not sure if it matters, but I'm not using a hook procedure.

Share this post


Link to post
Share on other sites
Advertisement
Are you using COM by any chance? GetOpenFileName() should only be called from a STA (single-threaded apartment) thread, not a MTA thread.

Share this post


Link to post
Share on other sites
As a matter of fact, I am using COM for some things. The application is also multithreaded, but all the windows programming is in the same thread.

EDIT (again): You were absolutely right. I got it all working now. Thanks!

[Edited by - BNY on July 16, 2008 9:27:25 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!