Creating ICON form BITMAP files

This is a discussion on Creating ICON form BITMAP files within the Windows Programming forums, part of the Platform Specific Boards category; I have a problem with creating icon form bitmap files my code is following: Code: // HWND o_hwnd - handle ...

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    10

    Creating ICON form BITMAP files

    I have a problem with creating icon form bitmap files my code is following:

    Code:
    
    
     // HWND o_hwnd  - handle to current window
     // import       - retrieves content of specified file 
    
     ICONINFO _iconInfo;
    
     PBITMAPFILEHEADER _pBmpFileHeader = (PBITMAPFILEHEADER)import("image.BMP");
    
     _iconInfo.hbmpColor = CreateDIBitmap (
       GetDC(o_hwnd),
       (PBITMAPINFOHEADER)(_pBmpFileHeader + 0x01),
       0x04,
       ((void*)_pBmpFileHeader)+_pBmpFileHeader.offBits,
       (PBITMAPINFO)(_pBmpFileHeader + 0x01),
       0
     );
         
     PBITMAPFILEHEADER _pMskFileHeader = (PBITMAPFILEHEADER)import("mask.BMP");
    
     _iconInfo.hbmpMask = CreateDIBitmap (
       GetDC(o_hwnd),
       (PBITMAPINFOHEADER)(_pMskFileHeader + 0x01),
       0x04,
       ((void*)_pMskFileHeader)+_pBmpFileHeader.offBits,
       (PBITMAPINFO)(_pMskFileHeader + 0x01),
       0
     );
                     
     _iconInfo.icon = TRUE;
    
     HICON _hIco = CreateIconIndirect(&_iconInfo);
     SendMessage(o_hwnd, WM_SETICON, 0, (LPARAM)_hIco);

    image.bmp is 24 bit color bitmap (16x16) - upper left image in all.bmp (attachment)
    mask.bmp is 1 bit color bitmap (16x16) - white circle on black background - upper right image in all.bmp (attachment)

    Icon on caption bar is fully visible with little darker circle.- lower right image in all.bmp (attachment)
    Icon on task bar is visible everything expect circle (It should be inverted) - lower left image in all.bmp (attachment)

    What is wrong?
    Attached Images Attached Images  

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Manually Loading Bitmap Files
    By CodeCriminal in forum C++ Programming
    Replies: 7
    Last Post: 10-30-2009, 09:19 PM
  2. Help creating a Bitmap
    By Kristian25 in forum Windows Programming
    Replies: 1
    Last Post: 02-25-2003, 04:17 AM
  3. Creating a prog to edit files with certin extention
    By destroyer32428 in forum C++ Programming
    Replies: 2
    Last Post: 11-25-2001, 02:08 AM
  4. Writing Bitmap Files
    By HappyDude in forum C++ Programming
    Replies: 1
    Last Post: 10-13-2001, 05:48 PM
  5. creating make files
    By Unregistered in forum Linux Programming
    Replies: 4
    Last Post: 09-22-2001, 01:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21