FileDialog 一次打开很多文件是不是有限制的?

christia 2007-03-25 11:58:07
FileDialog 打开很多文件是不是有限制的?
我一次选择很多文件的时候,大概是18个以上,就自动退出FileDialog 了,有什么办法解决呢?int a = dlg.domodel();a = 2了。
...全文
419 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
lb_hit 2007-03-25
  • 打赏
  • 举报
回复
打开多个文件的数目是没有限制的,但缓冲区需要自己提供,例如:
CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT,
_T("All files (*.*)|*.*||"));

char cBuffer[102400]; // 100 KB

cBuffer[0]='\0';
dlg.m_ofn.lpstrFile=cBuffer;
dlg.m_ofn.nMaxFile=sizeof(cBuffer); // buffer size
kimryo 2007-03-25
  • 打赏
  • 举报
回复
参数里面可以设置最大数目的~你设置足够的buffer就好了~

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

nMaxFile
Specifies the size, in TCHARs, of the buffer pointed to by lpstrFile. For the ANSI version, this is the number of bytes; for the Unicode version, this is the number of characters. The buffer must be large enough to store the path and file name string or strings, including the terminating NULL character. The GetOpenFileName and GetSaveFileName functions return FALSE if the buffer is too small to contain the file information. The buffer should be at least 256 characters long.

4,012

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 数据库
社区管理员
  • 数据库
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧