CFileDialog problem under win 98
-
Hello all I have a VC7 dialog based application. Basically one dialog with an edit box IDC_EDIT and 2 buttons IDC_READ_MYFILE IDC_CANCEL when I press the IDC_READ_MYFILE button i want to open a standard File Open Dialog, managed by the message_map entry, something like this: ON_BN_CLICKED(IDC_READ_MYFILE, OnReadMyfile) ... void CMyAppDlg::OnReadMyfile() { // TODO: Add your control notification handler code here static CString szFilter = "DXF Files (*.dxf)|*.dxf||"; CFileDialog fileDialog(TRUE, "dxf", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter, NULL ); if(fileDialog.DoModal() == IDOK) { CString sDXF_FileName; sDXF_FileName = fileDialog.GetPathName(); ... do some processing on this file UpdateData(FALSE); } } Tested under windows XP it *works fine* (opening the File Dialog and processing the selected file as needed) but under windows 98 it works but when pressing on the IDC_READ_MYFILE button nothing happens (the File Open dialog is not open) while the close button works and also the about message box works (called inside the dialog top left System menu) By the way I have checked the resources IDs and there isn't any conflict any help/tips will be greatly appreciated thanks in advance! best regards
-
Hello all I have a VC7 dialog based application. Basically one dialog with an edit box IDC_EDIT and 2 buttons IDC_READ_MYFILE IDC_CANCEL when I press the IDC_READ_MYFILE button i want to open a standard File Open Dialog, managed by the message_map entry, something like this: ON_BN_CLICKED(IDC_READ_MYFILE, OnReadMyfile) ... void CMyAppDlg::OnReadMyfile() { // TODO: Add your control notification handler code here static CString szFilter = "DXF Files (*.dxf)|*.dxf||"; CFileDialog fileDialog(TRUE, "dxf", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter, NULL ); if(fileDialog.DoModal() == IDOK) { CString sDXF_FileName; sDXF_FileName = fileDialog.GetPathName(); ... do some processing on this file UpdateData(FALSE); } } Tested under windows XP it *works fine* (opening the File Dialog and processing the selected file as needed) but under windows 98 it works but when pressing on the IDC_READ_MYFILE button nothing happens (the File Open dialog is not open) while the close button works and also the about message box works (called inside the dialog top left System menu) By the way I have checked the resources IDs and there isn't any conflict any help/tips will be greatly appreciated thanks in advance! best regards
This is an MFC7 bug I'm afraid. There is an MSDN article on this I think (you'll get the same problem on Win95 and older versions of NT4). The fix is to pass zero as the last param, e.g.:
CFileDialog fileDialog(TRUE, "dxf", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter, NULL, 0);
When I am king, you will be first against the wall.
-
This is an MFC7 bug I'm afraid. There is an MSDN article on this I think (you'll get the same problem on Win95 and older versions of NT4). The fix is to pass zero as the last param, e.g.:
CFileDialog fileDialog(TRUE, "dxf", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter, NULL, 0);
When I am king, you will be first against the wall.