OPENFILENAME
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.
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
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
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
Bye
Punika
Edited by - Punika on October 14, 2001 7:43:44 PM
Woohoo!
it works now.
i just declared OPENFILENAME Ofn; as a global
anyway thanks for taking your time.
it works now.
i just declared OPENFILENAME Ofn; as a global
anyway thanks for taking your time.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement