文件对话框constcharpszfilter [ ]=_ t (exefile (*.txt )|.txt|allfiles )|*.*|| ' );
cfiledialogDLG(true、NULL、NULL、ofn _ hidereadonly|ofn _ overwrite prompt,
pszFilter,this;
DLG.m _ ofn.lpstrinitialdir=' c :\ windows\ "; //设置对话框默认情况下绘制的路径
if(DLG.domodal(==idok ) )。
{
ctringstrfilepath=DLG.get pathname (;
/*如果有多个文件
for (position pos=DLG.get start position ); 销售点!=NULL; )
{
ctringstrfilepathname=DLG.get next pathname (pos );
*/
}
“保存”对话框constcharpszfilter [ ]=_ t (exefiles (*.txt )|*.txt|| ' );
cfiledialogdlgsave (假,//假保存
_t(.txt ),//自动附加的扩展名
_t(output.txt )、//默认保存的文件名
ofn _ hidereadonly|ofn _ overwrite prompt,
pszFilter,this;
目录选择对话框
浏览信息Bi;
char szPathName[MAX_PATH];
char szTitle[]='选择路径';
零内存(bi,sizeof ) browseinfo );
bi.hwndOwner=GetSafeHwnd (;
bi.pszDisplayName=szPathName;
bi.lpszTitle=szTitle;
bi.ulFlags=0x0040;
CString str;
CString strDir; //选定的目录
lpitemidlistidl=shbrowseforfolder (bi;
if(IDL==null )。
{
strDir=' ';
返回;
}
shgetpathfromidlist(IDL,str.getbuffer ) max_path*2);
str.ReleaseBuffer (;
if(str!=''str.getat(str.getlength ) (- 1 )!='\ "
str ='\ ";
strDir=str;
posted on 2006-12-06 16:17永生乐读(12537 )评论)0)编辑收藏引用所属分类: Windows MFC