zoukankan      html  css  js  c++  java
  • 获取文件详细信息的方法


    #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;
    }

  • 相关阅读:
    京东精益敏捷教练分享:敏捷助力产品创新!
    设计规范 | 详解组件控件结构体系
    Axure响应式进阶
    通讯录表设计
    TEST1
    c#练习四单元总结
    窗体控件应用总结(1)
    .NET(c#理解)
    test2-11
    test1-1
  • 原文地址:https://www.cnblogs.com/monotone/p/2842011.html
Copyright © 2011-2022 走看看