HBITMAP 转 HICON
[編輯] [转简体] (简体译文)
|
作者:huidong
| 分類:【編程】Win32
[
6 瀏覽
0 評論
0 贊
0 踩
]
概要
正文
// HBITMAP 转 HICON HICON HICONFromHBitmap(HBITMAP hBmp) { BITMAP bmp; GetObject(hBmp, sizeof(BITMAP), &bmp); HBITMAP hbmMask = CreateCompatibleBitmap(GetDC(NULL), bmp.bmWidth, bmp.bmHeight); ICONINFO ii = { 0 }; ii.fIcon = TRUE; ii.hbmColor = hBmp; ii.hbmMask = hbmMask; HICON hIcon = CreateIconIndirect(&ii); DeleteObject(hbmMask); return hIcon; }
不需要时,调用 DestroyIcon
改编自:https://blog.csdn.net/windows_nt/article/details/8470637