110,534
社区成员
发帖
与我相关
我的任务
分享
char c_filename[256];
memset(c_filename,0,256);
OPENFILENAME ofn;
memset(&ofn,0,sizeof(ofn));
ofn.lStructSize = sizeof(ofn);//或者直接指定为OPENFILENAME_SIZE_VERSION_400 ;
ofn.Flags = OFN_FILEMUSTEXIST|OFN_EXPLORER;
if (ofn.lStructSize == OPENFILENAME_SIZE_VERSION_400)
{
//msdn : For compatibility reasons, the Places Bar is hidden if Flags is set to OFN_ENABLEHOOK and lStructSize is OPENFILENAME_SIZE_VERSION_400.
ofn.Flags |= OFN_ENABLEHOOK;
}
else
{
ofn.FlagsEx = OFN_EX_NOPLACESBAR;
}
ofn.hwndOwner = NULL;
ofn.hInstance = NULL;
ofn.lpstrFilter = "txt file(*.txt)|*.txt\0";
ofn.lpstrFileTitle = c_filename;
ofn.nMaxFileTitle = 256;
ofn.lpstrFile = c_filename;
ofn.nMaxFile = 256;
ofn.lpstrTitle = "另存为";
GetSaveFileName(&ofn);
char c_filename[256];
memset(c_filename,0,256);
OPENFILENAME ofn;
memset(&ofn,0,sizeof(ofn));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; //关键是这里.
ofn.hwndOwner = NULL;
ofn.hInstance = NULL;
ofn.lpstrFilter = "txt file(*.txt)|*.txt\0";
ofn.lpstrFileTitle = c_filename;
ofn.nMaxFileTitle = 256;
ofn.lpstrFile = c_filename;
ofn.nMaxFile = 256;
ofn.lpstrTitle = "Select a file to open...";
ofn.Flags = OFN_FILEMUSTEXIST|OFN_ENABLEHOOK|OFN_EXPLORER; //OFN_ENABLEHOOK这个也要指定
//ofn.lpfnHook = OFNHookProcOldStyle; //这句可以不要?!!
GetSaveFileName(&ofn);
发现msdn这个API解释不是一般的麻烦啊.