Icon? help!

This is a discussion on Icon? help! within the C++ Programming forums, part of the General Programming Boards category; I can't seem to get this whole icon thing down. I'm using Dev C++ Here's what I'm doing. I go ...

  1. #1
    Unregistered
    Guest

    Question Icon? help!

    I can't seem to get this whole icon thing down. I'm using Dev C++
    Here's what I'm doing.

    I go to new. Start a new project as a "windows application".

    I go into "project options" and change the icon to the one of my choice. This creates the icon that shows up on the exe.
    (My icon is named 500 in my resource by default.)

    I just can't get the little icon in the toolbar or the icon in the titlebar of the program to change!

    This is sure to have something to do with it...
    wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION);

    Any help would be greatly appreciated!

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    2

    Lightbulb Update!

    Here's what I did to get it working!

    I changed these...
    wincl.lpszMenuName = NULL;
    wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION);

    to these...
    wincl.lpszMenuName = MAKEINTRESOURCE(IDR_MYMENU);
    wincl.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MYICON));
    wincl.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MYICON), IMAGE_ICON, 16, 16, 0);

    and added...
    #include "resource.h"
    to the top of the program code
    (right under #include <windows.h>)

    Then I added a file called resource.h to my project by right clicking on Project 1 (in the project manager) and selecting "new unit in project".

    I typed just this into it...
    #define IDR_MYMENU 101
    #define IDI_MYICON 201

    Then saved unit as resource.h.
    (Be sure to save the file type as "Header file (*.h)" in the drop down box.)

    Then added these to the top of the resource file (rsrc.rc)...
    #include <windows.h>
    #include "resource.h"
    IDI_MYICON ICON "c:/My Documents/menu_one.ico"

    Your icon may be named something other than menu_one.ico, change accordingly.

    and BAM!
    all done!


    Much thanks to "TheForger" at winprog.org for writing the help page I used. Found here...
    http://www.winprog.org/tutorial/menus.html
    Last edited by Worlamen; 12-22-2001 at 11:26 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Icon Help
    By The Brain in forum Windows Programming
    Replies: 11
    Last Post: 04-05-2009, 04:06 PM
  2. Problem with taskbar icon
    By maxorator in forum Windows Programming
    Replies: 2
    Last Post: 05-16-2006, 01:55 AM
  3. Problem with an icon in the TaskBar status area
    By dit6a9 in forum Windows Programming
    Replies: 2
    Last Post: 08-16-2004, 10:33 PM
  4. Icon problem
    By mkyong in forum Windows Programming
    Replies: 0
    Last Post: 02-17-2003, 04:39 PM
  5. icon in title bar?
    By Unregistered in forum Windows Programming
    Replies: 3
    Last Post: 12-12-2001, 05:43 PM

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