Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
DirDialog.cpp
Package: VC++视频传输.rar [view]
Upload User: hxb_1234
Upload Date: 2010-03-30
Package Size: 8328k
Code Size: 2k
Category:
Visual C++ Books
Development Platform:
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;
- }