绘制文件大图标(256*256)

#include <windows.h>
#include <CommCtrl.h>
#include <commoncontrols.h>

int WINAPI WinMain(
    HINSTANCE /* hInstance */,
    HINSTANCE /* hPrevInstance */,
    LPSTR /* lpCmdLine */,
    int /* nCmdShow */
    )
{
    HDC hdc = NULL;
    hdc = GetDC(0);

    SHFILEINFO sfi = {0};
    SHGetFileInfo("C:\\Program Files\\Internet Explorer\\iexplore.exe", -1, &sfi, sizeof(sfi), SHGFI_SYSICONINDEX);
    IImageList* imageList;
    SHGetImageList(SHIL_JUMBO, IID_IImageList, (void**)&imageList);
    
    HICON hIcon;
    imageList->GetIcon(sfi.iIcon, ILD_TRANSPARENT, &hIcon);
    
    DrawIconEx(hdc, 0, 0, hIcon, 256, 256, NULL, NULL, DI_NORMAL);
    
    imageList->Release();
    DestroyIcon(hIcon);
    ReleaseDC(0,hdc);

    return 0;
}

 

posted @ 2014-07-08 13:39  不是很难  阅读(803)  评论(0编辑  收藏  举报