分不够再加

解决方案 »

  1.   

    HBITMAP ConvertIconToBitmap(HICON hIcon)
    {
       HBITMAP hBmp;
       BITMAP bmp;
       CDC bmpDC;
       CDC iconDC;   ICONINFO    csII;
       bRetValue = ::GetIconInfo(hIcon, &csII);
       if (bRetValue == FALSE) return NULL;   bmpDC.Attach(::GetDC(NULL));
       iconDC.CreateCompatibleDC(&bmpDC);   if (::GetObject(csII.hbmColor, sizeof(BITMAP), &bmp))
        {
            DWORD   dwWidth = csII.xHotspot*2;
            DWORD   dwHeight = csII.yHotspot*2;        hBmp= ::CreateBitmap(dwWidth, dwHeight, bmp.bmPlanes, 
                                               bmp.bmBitsPixel, NULL);
            iconDC.SelectObject(csII.hbmColor);
            bmpDC.SelectObject(hBmp);
            bmpDC.BitBlt(0,0,dwWidth,dwHeight,&iconDC,0,0,SRCCOPY);
            return hBmp;
    }
      

  2.   

    作  者:  CloudWater (秋云开水)  
    等  级:    
    信 誉 值:  89 
      

  3.   

    typedef struct _ICONINFO { // ii 
       BOOL    fIcon; 
       DWORD   xHotspot; 
       DWORD   yHotspot; 
       HBITMAP hbmMask; 
       HBITMAP hbmColor; 
    } ICONINFO; 
     BOOL GetIconInfo(
      HICON hIcon,          // icon handle
      PICONINFO piconinfo   // address of icon structure
    );I think you have know how to do!
      

  4.   

    HICON hIcon;//你的hicon
    ICONINFO info;
    ::GetIconInfo (hIcon, &info);BITMAP bmp;
    ::GetObject (info.hbmColor, sizeof (BITMAP), (LPVOID) &bmp);HBITMAP hBmp = (HBITMAP) ::CopyImage (info.hbmColor, IMAGE_BITMAP, 0, 0, 0);//释放资源
    ::DeleteObject (hBmp);
    ::DeleteObject (info.hbmColor);
    ::DeleteObject (info.hbmMask);