用IShellDispatch 接口 获得文件的摘要信息

IShellDispatch* pShellDisp = NULL; Folder *pFolder; FolderItem *pFolderItem; CComBSTR stitle,str; HRESULT hr = S_OK; CoInitialize(NULL); hr = ::CoCreateInstance( CLSID_Shell, NULL, CLSCTX_SERVER, IID_IShellDispatch, (LPVOID*)&pShellDisp ); if( hr == S_OK ) { hr = pShellDisp->NameSpace(CComVariant(_T("E://a")),&pFolder); hr = pFolder->ParseName(CComBSTR(_T("a.mp3")),&pFolderItem); CComVariant vItem(pFolderItem); CComVariant vEmpty; int i = 0; char *ac = NULL; for (int i = 0 ;i < 100;i++) { hr = pFolder->GetDetailsOf(vEmpty,i,&stitle); hr = pFolder->GetDetailsOf(vItem,i,&str); COLE2T lpszTitle(stitle); COLE2T lpszInfo(str); TCHAR buf[300]; _stprintf(buf,_T("%s:%s"),lpszTitle.m_psz,lpszInfo.m_psz); int a = 1; } hr = pShellDisp->Release(); pShellDisp = NULL; } CoUninitialize();

你可能感兴趣的:(shell,server,null)