Thread: Display Small Icon ???

  1. #1
    Registered User
    Join Date
    Jan 2006

    Display Small Icon ???

    Pretty new to Windows programming. Trying to display icon in title bar on Non-Dialog window.

    //This works
    wincl.hIconSm = (HICON)LoadImage(hThisInstance, "mjsconvert2.ico", IMAGE_ICON, 16, 16, LR_LOADFROMFILE);
    //But this doesn't
    wincl.hIconSm = (HICON)LoadImage(hThisInstance, MAKEINTRESOURCE(IDI_ICO2), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
    //Neither does this
    wincl.hIconSm = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDI_ICO2));
    I can get icon to display with first example, but this requires external icon file.

    Can somebody please explain how to do this and why other examples do not work.

    Using Dev-cpp with MingW 3.3.1

    All Examples compile just fine.

  2. #2
    Registered User
    Join Date
    Sep 2004
    Set the icon when you register the window class, or during runtime you can set a new icon by sending the WM_SETICON message after calling LoadIcon().

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbee Q: reg. MFC dlg button & Vista UAC shield icon
    By colbyringeisen in forum Windows Programming
    Replies: 3
    Last Post: 12-29-2008, 05:16 PM
  2. display icon in tree control
    By sgh in forum Windows Programming
    Replies: 0
    Last Post: 04-30-2008, 08:54 AM
  3. about scan 7-segment display via parallel port
    By mobdawg in forum C Programming
    Replies: 4
    Last Post: 09-11-2002, 06:11 AM
  4. Speeding Up Display Time in CEditView :: MFC
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 04-22-2002, 07:24 PM
  5. NICE icon dev
    By Garfield in forum Windows Programming
    Replies: 10
    Last Post: 03-31-2002, 11:00 PM