SHOpenFolderAndSelectItems的用法
来源:互联网 发布:网络协议怎么学 编辑:程序博客网 时间:2024/05/16 08:39
LPITEMIDLIST pidl;
LPCITEMIDLIST cpidl;
LPCITEMIDLIST cpidl1;
LPSHELLFOLDER pDesktopFolder;
char szPath[MAX_PATH];
OLECHAR olePath[MAX_PATH];
ULONG chEaten;
ULONG dwAttributes;
HRESULT hr;
char szPath1[MAX_PATH];
//
// Get the path to the file we need to convert.
//
// GetCurrentDirectory(MAX_PATH, szPath);
sprintf(szPath, "D://code管理//Demo");
sprintf(szPath1, "D://code管理//Demo//HookManager_src.zip");
//
// Get a pointer to the Desktop's IShellFolder interface.
//
if (SUCCEEDED(SHGetDesktopFolder(&pDesktopFolder)))
{
//
// IShellFolder::ParseDisplayName requires the file name be in
// Unicode.
//
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szPath, -1,
olePath, MAX_PATH);
//
// Convert the path to an ITEMIDLIST.
//
hr = pDesktopFolder->ParseDisplayName(NULL,0,olePath,&chEaten,&pidl,&dwAttributes);
if (FAILED(hr))
{
AfxMessageBox("ERROR");
// Handle error.
}
cpidl = pidl;
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szPath1, -1,
olePath, MAX_PATH);
//
// Convert the path to an ITEMIDLIST.
//
hr = pDesktopFolder->ParseDisplayName(NULL,0,olePath,&chEaten,&pidl,&dwAttributes);
if (FAILED(hr))
{
AfxMessageBox("ERROR");
// Handle error.
}
cpidl1 = pidl;
HRESULT RE = CoInitialize(NULL);
int re = SHOpenFolderAndSelectItems(cpidl,1,&cpidl1,NULL);
//
// pidl now contains a pointer to an ITEMIDLIST for ./readme.txt.
// This ITEMIDLIST needs to be freed using the IMalloc allocator
// returned from SHGetMalloc().
//
//release the desktop folder object
pDesktopFolder->Release();
}
- SHOpenFolderAndSelectItems的用法
- SHOpenFolderAndSelectItems - 实现查找目标
- Windows下ShellExcute或者SHOpenFolderAndSelectItems 使用explorer.exe可能失败
- SHOpenFolderAndSelectItems——打开目标文件所在文件夹且选中目标文件
- ?的用法
- ?的用法
- ---" ~ " 的用法---
- ---" ~ " 的用法---
- ~ 的用法
- 的用法
- ##的用法
- ##的用法
- 的用法
- ${ }的用法
- ##的用法
- ${ }的用法
- "->"的用法
- ${ }的用法
- Silverlight的业务场景
- 对象的分别控制
- 使用HttpUnit进行集成测试
- java相对路径
- .NET代码生成器有助于快速应用程序开发
- SHOpenFolderAndSelectItems的用法
- 抛物运动轨迹线01
- 《The Old New Thing》中文版书名征集活动开始啦!
- VS 2008 JavaScript Debugging
- 抛物运动轨迹线02
- 为什么需要VLAN
- c#中的时间变量如何比较
- NFramework使用手册
- 正弦曲线及其波动01