Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to Load Icon

How to Load Icon

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    FarPointer
    wrote on last edited by
    #1

    Hi , Iam using the following code to load an icon HICON hIconImage; hIconImage = (HICON)LoadImage(NULL, MAKEINTRESOURCE (IDR_ICON ), IMAGE_ICON, ICON_SIZE, ICON_SIZE, LR_LOADTRANSPARENT|LR_CREATEDIBSECTION ); But hIconImage is NULL after the loading. Regards, FarPointer

    Y H 2 Replies Last reply
    0
    • F FarPointer

      Hi , Iam using the following code to load an icon HICON hIconImage; hIconImage = (HICON)LoadImage(NULL, MAKEINTRESOURCE (IDR_ICON ), IMAGE_ICON, ICON_SIZE, ICON_SIZE, LR_LOADTRANSPARENT|LR_CREATEDIBSECTION ); But hIconImage is NULL after the loading. Regards, FarPointer

      Y Offline
      Y Offline
      YaronNir
      wrote on last edited by
      #2

      Your first parameter of the LoadImage is (Taken from MSDN:) "hinst [in] Handle to an instance of the module that contains the image to be loaded. To load an OEM image, set this parameter to zero." so why do you use NULL? use something like AfxGetInstanceHandle().... Ask not what your application can do for you, Ask what you can do for your application

      1 Reply Last reply
      0
      • F FarPointer

        Hi , Iam using the following code to load an icon HICON hIconImage; hIconImage = (HICON)LoadImage(NULL, MAKEINTRESOURCE (IDR_ICON ), IMAGE_ICON, ICON_SIZE, ICON_SIZE, LR_LOADTRANSPARENT|LR_CREATEDIBSECTION ); But hIconImage is NULL after the loading. Regards, FarPointer

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        if icon is in resoruce use LoadIcon(AfxGetApp()->m_hInstance,name icon);

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups