OPENFILENAME

Started by
5 comments, last by Load Runner 22 years, 6 months ago
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.
Romance is dead,it was bougth by Disney and Hallmark and sold to the public in small portions.
Advertisement
make sure to #include commdlg.h
oops!
hehe sorry it wont happen again
all works now
Romance is dead,it was bougth by Disney and Hallmark and sold to the public in small portions.
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
Romance is dead,it was bougth by Disney and Hallmark and sold to the public in small portions.
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
Punika
Nope still the same
Romance is dead,it was bougth by Disney and Hallmark and sold to the public in small portions.
Woohoo!
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