• Advertisement

Archived

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

OPENFILENAME

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

Hi Im trying to create a Open File Dialog Box my problem is i declare this as a global OPENFILENAME Ofn; and i get these errors: error C2146: syntax error : missing '';'' before identifier ''Ofn'' error C2501: ''OPENFILENAME'' : missing storage-class or type specifiers i cant seem to understand why. any help is apriciated.

Share this post


Link to post
Share on other sites
Advertisement
Hmm.
well on second thought, it does not work at all
now when i push the menu item "Open" all it does is closing the window
heres the code:

case ID_MENU_FILE_OPEN:
{

OPENFILENAME Ofn;
char szFileName[MAX_PATH];

szFileName[0]=0;

Ofn.lStructSize = sizeof(Ofn);
Ofn.hwndOwner = hWnd;
Ofn.lpstrFilter = "Map Files (*.Map)\0\0";
Ofn.lpstrFile = szFileName;
Ofn.nMaxFile = MAX_PATH;
Ofn.Flags = OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_EXPLORER;
Ofn.lpstrDefExt = "Map";

GetOpenFileName(&Ofn);

}break;

any help is appriciated,as always

Share this post


Link to post
Share on other sites
It's Important that you set your Instance (HINSTANCE) too!! I think that is the problem.

Bye

Punika

Edited by - Punika on October 14, 2001 7:43:44 PM

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Woohoo!
it works now.
i just declared OPENFILENAME Ofn; as a global

anyway thanks for taking your time.

Share this post


Link to post
Share on other sites

  • Advertisement