获取文件详细信息的方法
2013-01-02 12:29
399 查看
#include "stdafx.h"
#include <iostream>
#include <string.h>
#include <windows.h>
#import <Shell32.dll>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
CoInitialize(NULL);
do
{
Shell32::IShellDispatchPtr ptrShell;
if(ptrShell.CreateInstance(__uuidof(Shell32::Shell)) != S_OK)
break;
wstring loWstrFolder = L"E:\\TEST";
//wchar_t npFilePath[] = L"E:\\1.jpg";
//CString lstrFilePath(npFilePath);
//lstrFilePath = lstrFilePath.Left(lstrFilePath.Find(PathFindFileName(npFilePath)));
Shell32::FolderPtr ptrFolder = ptrShell->NameSpace(loWstrFolder.c_str());
if(NULL == ptrFolder)
break;
Shell32::FolderItemPtr ptrItem = ptrFolder->ParseName(L"1.jpg");
if(NULL == ptrItem)
break;
// 3表示获取的信息内容索引序号,3代表获取最后修改日期
string lstrValue = ptrFolder->GetDetailsOf( _variant_t((IDispatch *)ptrItem), 3);
} while (false);
CoUninitialize();
return 0;
}
#include <iostream>
#include <string.h>
#include <windows.h>
#import <Shell32.dll>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
CoInitialize(NULL);
do
{
Shell32::IShellDispatchPtr ptrShell;
if(ptrShell.CreateInstance(__uuidof(Shell32::Shell)) != S_OK)
break;
wstring loWstrFolder = L"E:\\TEST";
//wchar_t npFilePath[] = L"E:\\1.jpg";
//CString lstrFilePath(npFilePath);
//lstrFilePath = lstrFilePath.Left(lstrFilePath.Find(PathFindFileName(npFilePath)));
Shell32::FolderPtr ptrFolder = ptrShell->NameSpace(loWstrFolder.c_str());
if(NULL == ptrFolder)
break;
Shell32::FolderItemPtr ptrItem = ptrFolder->ParseName(L"1.jpg");
if(NULL == ptrItem)
break;
// 3表示获取的信息内容索引序号,3代表获取最后修改日期
string lstrValue = ptrFolder->GetDetailsOf( _variant_t((IDispatch *)ptrItem), 3);
} while (false);
CoUninitialize();
return 0;
}
相关文章推荐
- 使用ShellClass获取文件属性详细信息的实现方法
- 获取dataview显示的文件的详细信息
- C#获取文件相关信息的方法
- Linux stat函数讲解(获取文件详细信息)
- C#获取文件详细备注信息,MP3的Tag等等
- 用Shell获取windows文件的详细信息
- Java如何从XML文件中获取节点信息的代码解析 Document方法
- C#获取文件详细备注信息
- C#获取文件详细备注信息
- apue第六章 系统数据文件和信息(详细分析shadow的加密方法)
- PHP获取mysql数据表的字段名称和详细信息的方法
- 使用ShellClass获取文件属性详细信息
- 如何在跨平台的情况下获取可执行文件的详细信息和属性
- VC获取文件时间信息的方法
- python获取文件版本信息、公司名和产品名的方法
- 利用stat命令获取Linux文件系统和文件的详细状态信息
- Go 获取文件基本信息方法
- 报表服务器上出现内部错误。有关详细信息,请参阅错误日志。 (rsInternalError) 获取联机帮助 用户的配置文件是临时配置文件。 (异常来自 HRESULT:0x80090024)
- VerQueryValue获取文件-属性-详细信息
- 解决方法:对性能监视器计数器注册表值执行系统配置检查失败。有关详细信息,请参阅自述文件或 SQL Server 联机丛书中的“如何在 SQL Server 2005 中为安装程序增加计数器注册表项值”