Skip to main content
GameDev.net gamedev.net
🔒 Locked

GetOpenFileName (Windows API)

Started by BNY Jul 16, 2008 at 7:39 PM 1 replies 800+ views
Original Post
BNY
BNY
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.
Ra
Ra
Are you using COM by any chance? GetOpenFileName() should only be called from a STA (single-threaded apartment) thread, not a MTA thread.
Ra
BNY
BNY
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]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.