HICON ExtractAssociatedIcon(
HINSTANCE hInst, // application instance handle
LPTSTR lpIconPath, // path and filename of file for which icon is wanted
LPWORD lpiIcon // pointer to icon index
);
该API可以取得某文件的关联图标,但得到的是32*32的图标,如何取得16*16大小的图标?
HINSTANCE hInst, // application instance handle
LPTSTR lpIconPath, // path and filename of file for which icon is wanted
LPWORD lpiIcon // pointer to icon index
);
该API可以取得某文件的关联图标,但得到的是32*32的图标,如何取得16*16大小的图标?
不过只试用于exe,dll以及ico文件
例如word文档abc.doc,在浏览器中显示时一般有32*32和16*16两种图标。使用ExtractAssociatedIcon可以得到32*32图标句柄,但如何才能获得16*16大小图标的句柄?(ExtractIconEx只是提取exe,dll和ico里的图标。)
不过对于提取小图标,我只知道上面的方法
ExtractIconEx可以返回大小图标的句柄
不过只适用于上面三种文件
var
finfo: _SHFILEINFO;
ico : TIcon;
begin
SHGetFileInfo(pchar('d:\naughtyboy.doc'),0,finfo,sizeof(finfo),SHGFI_SMALLICON or SHGFI_ICON or SHGFI_SYSICONINDEX);
Application.Icon.Handle := finfo.hIcon;
ico := ticon.Create;
ico.Handle := finfo.hIcon;
ico.SaveToFile('d:\aaa.ico');
ico.Free;
end;
果然好使!呵呵!
分不多,但全归你,多谢!