CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2005
    Location
    Netherlands, The
    Posts
    2,184

    Resolved [resolved]How to create hbitmap from hicon

    how to this?

    i tried find on google, but the keyword are to wide to search T_T
    Last edited by Mitsukai; September 14th, 2008 at 04:33 PM. Reason: resolved

  2. #2
    Join Date
    Oct 2005
    Posts
    230

    Re: How to create hbitmap from hicon

    Code:
    HBITMAP BitmapFromIcon(HICON hIcon)
    {
       HDC hDC = CreateCompatibleDC(NULL);
       HBITMAP hBitmap = CreateCompatibleBitmap(hDC, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON));
       HBITMAP hOldBitmap = (HBITMAP)SelectObject(hDC, hBitmap);
       DrawIcon(hDC, 0, 0, hIcon);
       SelectObject(hDC, hOldBitmap);
       DeleteDC(hDC);
    
       return hBitmap;
    }
    Learning somthing new every day!

  3. #3
    Join Date
    Aug 2005
    Location
    Netherlands, The
    Posts
    2,184

    Re: How to create hbitmap from hicon

    thanks you alot it helped

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured