Thread: Menus

  1. #16
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    the MSDN library is also available online:

    http://msdn.microsoft.com/library/default.asp
    "There are three kinds of people in the world...
    Those that can count and those that can't."

  2. #17
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    Wasnt actually of my application, but of one specific window.. I mean so that a window has got an icon located: F:\Icons\Main.ico
    Thanks
    what does signature stand for?

  3. #18
    Registered User foniks munkee's Avatar
    Join Date
    Nov 2001
    Posts
    343
    Well, if you haven't created the icon as a resource then you probably have to load the icon at runtime.

    You could do this by processing the WM_CREATE message in your windows procedure function. (I am assuming we are talking windows here and not console.. )

    This following code when processed after a WM_CREATE message from the windows message loop will load a .ico file and use it as an icon. Note that this code only loads the 32x32 version of the icon - You will need to execute it again for the 16x16 size. (and make sure you get another handle to the smaller icon.. i.e. hIconSm). This in effect sets the values of wc.hIcon and wc.hIconSm in your windows class. (Assuming you have called your windows class wc).
    Code:
    HICON hIcon;
    
    hIcon = LoadImage(NULL, "Icon.ico", IMAGE_ICON, 32, 32, LR_LOADFROMFILE);
    if(hIcon)
         SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
    else
         MessageBox(hwnd, "Couldn't load icon!", "ERROR!", MB_OK | MB_ICONERROR);
    Hope this makes sense, this is a bit rushed.

    Oh - if you don't know, the 32x32 icon is used when your program is minimised in the task bar, the 16x16 icon is located in the top left corner of your program. So, concievably you could have two completely different icons if you so chose!
    Last edited by foniks munkee; 07-09-2002 at 11:38 PM.
    "Queen and huntress, chaste and fair,
    Now the sun is laid to sleep,
    Seated in thy silver chair,
    State in wonted manner keep."

  4. #19
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    Ok, I'll try it
    what does signature stand for?

  5. #20
    Registered User foniks munkee's Avatar
    Join Date
    Nov 2001
    Posts
    343
    http://winprog.org/tutorial/menus.html

    Actually just had a look at my example, and I haven't done everything that you require... Have a look at this example - or have a look at Charles Petzolds book "Programming Windows". Excellent tuts in that.

    If you aren't clear on anything, just post again with some code.
    "Queen and huntress, chaste and fair,
    Now the sun is laid to sleep,
    Seated in thy silver chair,
    State in wonted manner keep."

  6. #21
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    Thanks, I'll check it out
    what does signature stand for?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Win32 menus and resources help
    By firestorm in forum Windows Programming
    Replies: 24
    Last Post: 04-12-2005, 01:23 PM
  2. Creating pop up menus
    By Ti22 in forum C++ Programming
    Replies: 22
    Last Post: 01-18-2005, 09:27 PM
  3. help with menus example?
    By The Gweech in forum Windows Programming
    Replies: 3
    Last Post: 03-30-2004, 04:41 PM
  4. Menu's
    By Benzakhar in forum Windows Programming
    Replies: 1
    Last Post: 02-20-2004, 10:13 PM
  5. adding menus at runtime
    By bennyandthejets in forum Windows Programming
    Replies: 3
    Last Post: 11-22-2002, 05:07 AM