小问题:如何使CFileDialog 在DoModal() 时显示指定的目录,而不是默认目录 如何使CFileDialog 在DoModal() 时显示指定的目录,而不是默认目录 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 CFileDialog dlg(TRUE, TEXT("TXT"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, TEXT("文本文件(*.txt)|*.txt|所有文件(*.*)|*.*||"), this);dlg.m_ofn.lpstrInitialDir="C:\\XXX\\";dlg.DoMal(); CFileDialog fd;fd.m_ofn.lpstrInitialDir= 楼上说的对。m_ofn is a structure of type OPENFILENAME. Use this structure to initialize the appearance of a File Open or File Save As dialog box after it is constructed but before it is displayed with the DoModal member function. typedef struct tagOFN { DWORD lStructSize; HWND hwndOwner; HINSTANCE hInstance; LPCTSTR lpstrFilter; LPTSTR lpstrCustomFilter; DWORD nMaxCustFilter; DWORD nFilterIndex; LPTSTR lpstrFile; DWORD nMaxFile; LPTSTR lpstrFileTitle; DWORD nMaxFileTitle; LPCTSTR lpstrInitialDir; LPCTSTR lpstrTitle; DWORD Flags; WORD nFileOffset; WORD nFileExtension; LPCTSTR lpstrDefExt; LPARAM lCustData; LPOFNHOOKPROC lpfnHook; LPCTSTR lpTemplateName; #if (_WIN32_WINNT >= 0x0500) void * pvReserved; DWORD dwReserved; DWORD FlagsEx;#endif // (_WIN32_WINNT >= 0x0500)} OPENFILENAME, *LPOPENFILENAME; 坐骨神经痛怎么办 CScrollView类 为什么只有纵向滚动条? 为何CListView插入的项无法显示? CHtmlEditCtrl SetDesignMode问题 qq的键盘机密技术是怎么做的? 关于IE的COM接口编程。IHTMLDocument。。。。 对话框向单文档转化的问题(菜鸟问题) debug与release的问题 高分求救!!!怎么在自己写的控件里得到容器对象??? 提个较菜的问题,如何下载或升级到新版的MSDN的? 如何查看dll中的函数,不是引出函数 寻找快速查找两个文件内容异同点的算法.
dlg.m_ofn.lpstrInitialDir="C:\\XXX\\";
dlg.DoMal();
fd.m_ofn.lpstrInitialDir=
m_ofn is a structure of type OPENFILENAME. Use this structure to initialize the appearance of a File Open or File Save As dialog box after it is constructed but before it is displayed with the DoModal member function.
DWORD lStructSize;
HWND hwndOwner;
HINSTANCE hInstance;
LPCTSTR lpstrFilter;
LPTSTR lpstrCustomFilter;
DWORD nMaxCustFilter;
DWORD nFilterIndex;
LPTSTR lpstrFile;
DWORD nMaxFile;
LPTSTR lpstrFileTitle;
DWORD nMaxFileTitle;
LPCTSTR lpstrInitialDir;
LPCTSTR lpstrTitle;
DWORD Flags;
WORD nFileOffset;
WORD nFileExtension;
LPCTSTR lpstrDefExt;
LPARAM lCustData;
LPOFNHOOKPROC lpfnHook;
LPCTSTR lpTemplateName;
#if (_WIN32_WINNT >= 0x0500)
void * pvReserved;
DWORD dwReserved;
DWORD FlagsEx;
#endif // (_WIN32_WINNT >= 0x0500)
} OPENFILENAME, *LPOPENFILENAME;