mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-18 14:56:07 +00:00
Implemented folder picker dialog
This commit is contained in:
parent
70717c02d0
commit
d21ed0a69d
@ -54,8 +54,7 @@ BEGIN
|
||||
PUSHBUTTON "Pick File...",IDC_SELECTFILE,29,43,55,13
|
||||
DEFPUSHBUTTON "OK",IDOK,170,5,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,170,25,50,14
|
||||
PUSHBUTTON "Pick Folder...",IDC_SELECTFOLDER,89,43,55,13,
|
||||
WS_DISABLED
|
||||
PUSHBUTTON "Pick Folder...",IDC_SELECTFOLDER,89,43,55,13
|
||||
END
|
||||
|
||||
|
||||
|
@ -62,6 +62,49 @@ void CScanForFilesDlg::OnSelectFile()
|
||||
|
||||
void CScanForFilesDlg::OnSelectFolder()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
|
||||
BROWSEINFO bi;
|
||||
TCHAR szFolder[MAX_PATH + 1];
|
||||
|
||||
memset(szFolder, 0, sizeof(szFolder));
|
||||
|
||||
memset(&bi, 0, sizeof(bi));
|
||||
bi.hwndOwner = GetSafeHwnd();
|
||||
bi.pidlRoot = NULL;
|
||||
bi.pszDisplayName = szFolder;
|
||||
bi.lpszTitle = _T("Pick a folder to scan");
|
||||
|
||||
// Open the folder browser dialog
|
||||
LPITEMIDLIST pItemList = SHBrowseForFolder(&bi);
|
||||
if (pItemList)
|
||||
{
|
||||
IMalloc *pShellAllocator = NULL;
|
||||
|
||||
SHGetMalloc(&pShellAllocator);
|
||||
if (pShellAllocator)
|
||||
{
|
||||
char szPath[MAX_PATH + 1];
|
||||
|
||||
if (SHGetPathFromIDList(pItemList, szPath))
|
||||
{
|
||||
// Chop off the end path seperator
|
||||
int nPathSize = strlen(szPath);
|
||||
if (nPathSize > 0)
|
||||
{
|
||||
if (szPath[nPathSize - 1] == '\\')
|
||||
{
|
||||
szPath[nPathSize - 1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
// Form the file pattern
|
||||
USES_CONVERSION;
|
||||
m_sFilePattern.Format(_T("%s\\*.*"), A2T(szPath));
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
pShellAllocator->Free(pItemList);
|
||||
pShellAllocator->Release();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,9 @@
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxtempl.h>
|
||||
#include <afxmt.h>
|
||||
#include <afxpriv.h>
|
||||
|
||||
#include <shlobj.h>
|
||||
|
||||
// This macro is the same as IMPLEMENT_OLECREATE, except it passes TRUE
|
||||
// for the bMultiInstance parameter to the COleObjectFactory constructor.
|
||||
|
Loading…
x
Reference in New Issue
Block a user