'将ICO转换成 BMP格式
'从资源里加载图标，但是会变大 'b= LoadIcon(app.hInstance,"IMAGE_ULOCK_16")   %IMAGE_BITMAP
'从文件中读图标' b= LoadImage(0,"X:\PB文件库\Projects\文件编辑器\images\ulock_16.ico",%IMAGE_ICON,16,16,%LR_LOADFROMFILE) 
'从资源里加载图标， b=LoadImage(app.hInstance,"IMAGE_ULOCK_16",%IMAGE_ICON, 16, 16, %LR_DEFAULTCOLOR)
'转换 a=IconToBitmap(b,GetSysColor(%Color_menu))
'a=LoadImage(app.hInstance,"IMAGE_WIN", %IMAGE_BITMAP, 16, 16, %LR_DEFAULTCOLOR)
'DeleteObject b
Function IconToBitmap(ByVal HICON as HICON, ByVal Background as ULong) as HBITMAP
   Dim ret as Integer
   Dim as ULong  hBmp ,w,h
   Dim pif as ICONINFO, rt as Rect, hBrush as HBRUSH
   Dim DC as hDC, hDib as HBITMAP, bi as BITMAPINFO, lpBits as Integer, oldobj as HGDIOBJ
   
   GetIconInfo(HICON, @pif)
   w = pif.xHotspot * 2
   h = pif.yHotspot * 2
   bi.bmiHeader.biSize = SizeOf(bi.bmiHeader)
   bi.bmiHeader.biPlanes = 1
   bi.bmiHeader.biBitCount = 24
   bi.bmiHeader.biWidth = w
   bi.bmiHeader.biHeight = h
   bi.bmiHeader.biSizeImage = 4 * ((w * bi.bmiHeader.biBitCount + 31) \ 32) * h
   
   DC = CreateCompatibleDC(0)
   
   hdib = CreateDIBSection(DC, @bi, DIB_RGB_COLORS, CPtr(any ptr, @lpBits), 0, 0)
   oldobj = SelectObject(DC, hDib)
   rt.Right = w
   rt.Bottom = h
   hBrush = CreateSolidBrush(Background)
   FillRect(DC, @rt, hBrush)
   DrawIconEx(DC, 0, 0, HICON, 0, 0, 0, 0, DI_NORMAL)
   
   hDib = SelectObject(DC, oldobj)
   
   DeleteObject(hBrush)
   DeleteDC(DC)
   Function = hDib
   
End Function