MCPcopy Create free account
hub / github.com/ThirteenAG/WidescreenFixesPack / CreateIconFromBMP

Function CreateIconFromBMP

includes/stdafx.cpp:373–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

371}
372
373HICON CreateIconFromBMP(UCHAR* data)
374{
375 BITMAPINFOHEADER* bmih = (BITMAPINFOHEADER*)(data + sizeof(BITMAPFILEHEADER));
376 HICON hIcon = 0;
377 ICONINFO ii = {};
378 ULONG n = bmih->biWidth * bmih->biHeight;
379 PULONG lpBits = new ULONG[n];
380 PULONG p = lpBits;
381 if (ii.hbmColor = CreateBitmap(bmih->biWidth, bmih->biHeight, 1, bmih->biBitCount, (data + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER))))
382 {
383 if (ii.hbmMask = CreateBitmap(bmih->biWidth, bmih->biHeight, 1, 1, 0))
384 {
385 hIcon = CreateIconIndirect(&ii);
386 DeleteObject(ii.hbmMask);
387 }
388 DeleteObject(ii.hbmColor);
389 }
390 delete[] lpBits;
391 return hIcon;
392}
393
394HICON CreateIconFromResourceICO(UINT nID, int32_t cx, int32_t cy)
395{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected