開啟對話方塊開啟多個檔案

2021-07-09 04:31:02 字數 575 閱讀 2775

專案中需要開啟多個檔案,注意的地方1 ofn_allowmultiselect  2 m_ofn.lpstrfile要分配大點的記憶體

我發現:用ctrl+a全選檔案,檔名按從小到大加進去。用shift新增檔案,檔名不是按從小到大加進去的。

cstring  strfilepath;

cstring strfilename;

int npos;

cfiledialog filedlg(true,null,null, ofn_hidereadonly| ofn_overwriteprompt|ofn_allowmultiselect,"tab files(*.tab)|*.tab|");

char* pbuf=new char[1024*10];

memset(pbuf, 0, 1024*10);

filedlg.m_ofn.lpstrfile=pbuf;

filedlg.m_ofn.nmaxfile=1024*10;

if(idok==filedlg.domodal())

}delete pbuf;

MFC開啟檔案對話方塊

摘自msdn cfiledialog dlgfile true cstring filename const int c cmaxfiles 100 const int c cbbuffsize c cmaxfiles max path 1 1 dlgfile.getofn lpstrfile fi...

開啟選擇檔案對話方塊

檔案路徑最後儲存在str中 cstring str char name max path browseinfo bi zeromemory bi,sizeof browseinfo bi.hwndowner getsafehwnd bi.pidlroot null bi.pszdisplayname...

MFC開啟檔案對話方塊

僅為學習用!文章出處 cfiledialog類封裝了windows常用的檔案對話方塊。常用的檔案對話方塊提供了一種簡單的與windows標準相一致的檔案開啟和檔案存檔對話方塊功能。cfiledialog的語法 第乙個引數 bopenfiledialog為true或false。true為開啟檔案 fa...