GetOpenFileName()中的lpstrFilter设置问题
BOOL PopFileOpenDlg(HWND hwnd, LPSTR lpstrFileName, LPSTR lpstrTitleName)
{
static char szFilter[] = "数据文件(*.dat)|*.dat";
ofn.lStructSize = sizeof (OPENFILENAME) ;
ofn.hwndOwner = hwnd ;
ofn.hInstance = NULL ;
ofn.lpstrFilter = szFilter ;
ofn.lpstrCustomFilter = NULL ;
ofn.nMaxCustFilter = 0 ;
ofn.nFilterIndex = 0 ;
ofn.lpstrFile = lpstrFileName ;
ofn.nMaxFile = 100;
ofn.lpstrFileTitle = lpstrTitleName ;
ofn.nMaxFileTitle = 100;
ofn.lpstrInitialDir = NULL ;
ofn.lpstrTitle = NULL ;
ofn.Flags = FN_FILEMUSTEXIST|OFN_READONLY ;
ofn.nFileOffset = 0 ;
ofn.nFileExtension = 0 ;
ofn.lCustData = 0L ;
ofn.lpfnHook = NULL ;
ofn.lpTemplateName = NULL ;
return GetOpenFileName (&ofn) ;
}
为什么调用这个函数出来的对话框显示所有文件,而不是只显示dat文件