- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
DirDialog.cpp
资源名称:VC++视频传输.rar [点击查看]
上传用户:hxb_1234
上传日期:2010-03-30
资源大小:8328k
文件大小:2k
源码类别:
VC书籍
开发平台:
Visual C++
- #include "DirDialog.h"
- #include <shlobj.h>
- static int __stdcall BrowseCtrlCallback(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
- {
- CDirDialog* pDirDialogObj = (CDirDialog*)lpData;
- if (uMsg == BFFM_INITIALIZED && !pDirDialogObj->m_strSelDir != NULL)
- {
- }
- else
- {
- }
- return 0;
- }
- CDirDialog::CDirDialog()
- {
- this->m_strPath = (char *) new char[32768];
- this->m_strInitDir = NULL;
- this->m_strSelDir = NULL;
- this->m_strTitle = NULL;
- }
- CDirDialog::~CDirDialog()
- {
- }
- int CDirDialog::DoBrowse()
- {
- BROWSEINFO bInfo;
- LPITEMIDLIST pidl;
- ZeroMemory ( (PVOID) &bInfo,sizeof (BROWSEINFO));
- if (m_strInitDir != NULL)
- {
- OLECHAR olePath[MAX_PATH];
- ULONG chEaten;
- ULONG dwAttributes;
- HRESULT hr;
- LPSHELLFOLDER pDesktopFolder;
- if (SUCCEEDED(SHGetDesktopFolder(&pDesktopFolder)))
- {
- MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, m_strInitDir, -1,
- olePath, MAX_PATH);
- hr = pDesktopFolder->ParseDisplayName(NULL,
- NULL,
- olePath,
- &chEaten,
- &pidl,
- &dwAttributes);
- bInfo.pidlRoot = pidl;
- }
- }
- bInfo.hwndOwner = NULL;
- bInfo.pszDisplayName = m_strPath;
- bInfo.lpszTitle = "Select Directory";
- bInfo.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
- bInfo.lpfn = BrowseCtrlCallback;
- bInfo.lParam = (LPARAM)this;
- if ((pidl = SHBrowseForFolder(&bInfo)) == NULL)
- {
- return 0;
- }
- m_iImageIndex = bInfo.iImage;
- if (SHGetPathFromIDList(pidl, m_strPath) == FALSE)
- {
- return 0;
- }
- return 1;
- }