GetOpenFileName The GetOpenFileName function creates an Open dialog box that lets the user specify the drive, directory, and the name of a file or set of files to open. BOOL GetOpenFileName( LPOPENFILENAME lpofn // initialization data );Return Values If the user specifies a file name and clicks the OK button, the return value is nonzero. The buffer pointed to by the lpstrFile member of the OPENFILENAME structure contains the full path and file name specified by the user.If the user cancels or closes the Open dialog box or an error occurs, the return value is zero. To get extended error information, call the CommDlgExtendedError function, which can return one of the following values: CDERR_DIALOGFAILURE CDERR_FINDRESFAILURE CDERR_NOHINSTANCE CDERR_INITIALIZATION CDERR_NOHOOK CDERR_LOCKRESFAILURE CDERR_NOTEMPLATE CDERR_LOADRESFAILURE CDERR_STRUCTSIZE CDERR_LOADSTRFAILURE FNERR_BUFFERTOOSMALL CDERR_MEMALLOCFAILURE FNERR_INVALIDFILENAME CDERR_MEMLOCKFAILURE FNERR_SUBCLASSFAILURE
The GetOpenFileName function creates an Open dialog box that lets the user specify the drive, directory, and the name of a file or set of files to open. BOOL GetOpenFileName(
LPOPENFILENAME lpofn // initialization data
);Return Values
If the user specifies a file name and clicks the OK button, the return value is nonzero. The buffer pointed to by the lpstrFile member of the OPENFILENAME structure contains the full path and file name specified by the user.If the user cancels or closes the Open dialog box or an error occurs, the return value is zero. To get extended error information, call the CommDlgExtendedError function, which can return one of the following values: CDERR_DIALOGFAILURE
CDERR_FINDRESFAILURE
CDERR_NOHINSTANCE
CDERR_INITIALIZATION
CDERR_NOHOOK
CDERR_LOCKRESFAILURE
CDERR_NOTEMPLATE
CDERR_LOADRESFAILURE
CDERR_STRUCTSIZE
CDERR_LOADSTRFAILURE
FNERR_BUFFERTOOSMALL
CDERR_MEMALLOCFAILURE
FNERR_INVALIDFILENAME
CDERR_MEMLOCKFAILURE
FNERR_SUBCLASSFAILURE
GetOpenFileName(&ofn)那些参数是必须设的,我设置如下:
ofn.hInstance = AfxGetInstanceHandle();
ofn.lpstrFile = szFile;
ofn.lpstrFilter = "JPEG Files (*.jpg)|*.jpg|";
ofn.hwndOwner = AfxGetMainWnd()->m_hWnd;
怎么显示不了对话框阿?