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. icon loading

icon loading

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestion
3 Posts 2 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.
  • W Offline
    W Offline
    will1383
    wrote on last edited by
    #1

    Hi all, I have an an application that is a Popup Dialog box in a dll. I'm using MFC 6.0. my problem is I'm trying to load a menu bar icon on the sucker, and I just can't get it to load. I thought I do this: SetIcon(::LoadIcon(NULL,MAKEINTRESOURCE(IDR_MAINFRAME)),FALSE); in the OnCreate Overrideable in my CDialog-derived class. Doesn't work though. It always returns 0x000000 for the HICON. any suggestions on how to do this? I'm sure I'm just putting it in the wrong place or performing the operation wrong. Any insight, comments or suggestions are greatly appreciated. Thanks!

    A 1 Reply Last reply
    0
    • W will1383

      Hi all, I have an an application that is a Popup Dialog box in a dll. I'm using MFC 6.0. my problem is I'm trying to load a menu bar icon on the sucker, and I just can't get it to load. I thought I do this: SetIcon(::LoadIcon(NULL,MAKEINTRESOURCE(IDR_MAINFRAME)),FALSE); in the OnCreate Overrideable in my CDialog-derived class. Doesn't work though. It always returns 0x000000 for the HICON. any suggestions on how to do this? I'm sure I'm just putting it in the wrong place or performing the operation wrong. Any insight, comments or suggestions are greatly appreciated. Thanks!

      A Offline
      A Offline
      AlexO
      wrote on last edited by
      #2

      in debug(watch) window enter the following "@err, hr" What is the value of that expression after the line above is executed?

      W 1 Reply Last reply
      0
      • A AlexO

        in debug(watch) window enter the following "@err, hr" What is the value of that expression after the line above is executed?

        W Offline
        W Offline
        will1383
        wrote on last edited by
        #3

        As it turns out, when using the LoadIcon you must get the HINSTANCE of the dialog in the dll, not the application HINSTANCE. That fixed my problem. thanks for the help though! :)

        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