/************************************************************************** * IExtractIconA::Extract */ static HRESULT WINAPI IExtractIconA_fnExtract(IExtractIconA * iface, LPCSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize) { IExtractIconWImpl *This = impl_from_IExtractIconA(iface); HRESULT ret; INT len = MultiByteToWideChar(CP_ACP, 0, pszFile, -1, NULL, 0); LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); TRACE("(%p) (file=%p index=%u %p %p size=%u)\n", This, pszFile, nIconIndex, phiconLarge, phiconSmall, nIconSize); MultiByteToWideChar(CP_ACP, 0, pszFile, -1, lpwstrFile, len); ret = IExtractIconW_Extract(&This->IExtractIconW_iface, lpwstrFile, nIconIndex, phiconLarge, phiconSmall, nIconSize); HeapFree(GetProcessHeap(), 0, lpwstrFile); return ret; }
static BOOL create_combobox_item(IShellFolder *folder, LPCITEMIDLIST pidl, IImageList *icon_list, COMBOBOXEXITEMW *item) { STRRET strret; HRESULT hres; IExtractIconW *extract_icon; UINT reserved; WCHAR icon_file[MAX_PATH]; INT icon_index; UINT icon_flags; HICON icon; strret.uType=STRRET_WSTR; hres = IShellFolder_GetDisplayNameOf(folder,pidl,SHGDN_FORADDRESSBAR,&strret); if(FAILED(hres)) { WINE_WARN("Could not get name for pidl\n"); return FALSE; } switch(strret.uType) { case STRRET_WSTR: item->pszText = strret.u.pOleStr; break; default: WINE_FIXME("Unimplemented STRRET type:%u\n",strret.uType); break; } hres = IShellFolder_GetUIObjectOf(folder,NULL,1,&pidl,&IID_IExtractIconW, &reserved,(void**)&extract_icon); if(SUCCEEDED(hres)) { item->mask |= CBEIF_IMAGE; IExtractIconW_GetIconLocation(extract_icon,GIL_FORSHELL,icon_file, sizeof(icon_file)/sizeof(WCHAR), &icon_index,&icon_flags); IExtractIconW_Extract(extract_icon,icon_file,icon_index,NULL,&icon,20); item->iImage = ImageList_AddIcon((HIMAGELIST)icon_list,icon); IExtractIconW_Release(extract_icon); } else { item->mask &= ~CBEIF_IMAGE; WINE_WARN("Could not get an icon for %s\n",wine_dbgstr_w(item->pszText)); } return TRUE; }