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


GetOpenFileName() in MFC???

Recommended Posts

hi there I’m trying to create a ''open dialog box'' with GetOpenFileName() in an mfc model dialog. This is how I try to do it but it just does not want to work char fileName[256]; OPENFILENAME openParams; openParams.lStructSize = sizeof(OPENFILENAME); openParams.hwndOwner = m_hWnd; openParams.lpstrFilter = "Raw File (*.RAW)\0*.RAW\0\0"; openParams.lpstrCustomFilter = NULL; openParams.nFilterIndex = 1; openParams.lpstrFile = fileName; openParams.nMaxFile = 256; openParams.lpstrTitle = "Load RAW Image File...\0"; openParams.lpstrFileTitle = NULL; openParams.lpstrDefExt = "*\0"; openParams.lpstrInitialDir = NULL; openParams.Flags = OFN_FILEMUSTEXIST | OFN_READONLY | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY; if(GetOpenFileName(&openParams)) SetDlgItemText(IDC_FILENAME, fileName); Any ideas, or can any one help me with a better way to do this

Share this post

Link to post
Share on other sites