Loading image from a file (program icon)

This is a discussion on Loading image from a file (program icon) within the Windows Programming forums, part of the Platform Specific Boards category; Hi! I have a problem loading an image from a file for program icon. This is the code Code: wndClass.hIcon ...

  1. #1
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669

    Loading image from a file (program icon)

    Hi!

    I have a problem loading an image from a file for program icon.

    This is the code
    Code:
     wndClass.hIcon = LoadIcon(hInstance, ".\\DATA\\GRAPHICS\\plus.ico");
    What's the problem?
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

  2. #2
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    LoadIcon is used for loading icons stored in your executable. It is not used for loading icon files.

    Try LoadImage instead.

  3. #3
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669
    LoadImage works for the icon, which is inside the program. But I really need to use the resources if I want to have an iconic exe file.

    Thank you for your help.
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

  4. #4
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    You must specify the resource name of your icon then.

    If your icon has an ID, use the MAKEINTRESOURCE() macro.

  5. #5
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669
    Yes, I know how to use resources. Thanks!
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 02:42 AM
  2. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 05:27 PM
  3. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 05:14 AM
  4. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 11:04 PM

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