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();
转载于:https://my.oschina.net/guqiwei/blog/351091