Thread: Loading image from a file (program icon)

  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
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    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
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    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, 01:42 AM
  2. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  3. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04: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, 10:04 PM