还是这样:DWORD MAXFILE=200; //200 is the max
dlg.m_ofn.nMaxFile=MAXFILE;
char* pc = new char[MAXFILE];
dlg.m_ofn.lpstrFile = pc;
dlg.m_ofn.lpstrFile[0] = NULL;//缺了这里的
dlg.m_ofn.nMaxFile=MAXFILE;
char* pc = new char[MAXFILE];
dlg.m_ofn.lpstrFile = pc;
dlg.m_ofn.lpstrFile[0] = NULL;//缺了这里的
{
// TODO: Add your control notification handler code here
char *ls_buffer;
ls_buffer=(char *)GlobalAlloc(GPTR,14000);
POSITION posfilespath;
int i,mm;
CString str;
CString strFileName;
CString sFilter="All Files(*.*)|*.*||";
CFileDialog Dlg(TRUE,NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_ALLOWMULTISELECT|OFN_ENABLESIZING|OFN_EXPLORER ,
(LPCTSTR)sFilter,NULL);
Dlg.m_ofn.nMaxFile=1024;
Dlg.m_ofn.lpstrFile=ls_buffer;
if(Dlg.DoModal()!=IDOK)return; posfilespath=Dlg.GetStartPosition();
for(i=0;posfilespath!=NULL;i++) {
strFileName=Dlg.GetNextPathName(posfilespath);
}
GlobalFree(ls_buffer);
}