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. Accessing Instance & Resource Handle from an Extention DLL

Accessing Instance & Resource Handle from an Extention DLL

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++databasevisual-studiolearning
1 Posts 1 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.
  • D Offline
    D Offline
    D D de Kerf
    wrote on last edited by
    #1

    Hi y'all, moving up in software development, I thought it was a good idea to dive into extention DLL's. I've developed a suite of database-access classes which has grown up to 30 files, so I thought it would be nice to pack all these in a .lib and .dll file so distribution would be easier. One of the features of the classes is creating a taskbaricon (which is a Dundas component, derived from CWnd). But ever since I put my classes inside an MFC extention DLL, the creation of the taskbaricon fails. This is the reason why: * First a window is created with CreateEx(0, AfxRegisterWndClass(CS_CLASSDC | CS_GLOBALCLASS), NULL, 0, 0, 0, 0, 0, NULL, NULL) However, AfxRegisterWndClass calls AfxGetInstanceHandle and returns a NULL-value or something. Even though MSDN says that AfxGetInstanceHandle should return the handle of the dll in this case... * After the window creation an icon has to be extracted from the resource (which I also put inside dll). But as soon as the icon is created using ::LoadIcon(AfxFindResourceHandle(MAKEINTRESOURCE(nIDResource), RT_GROUP_ICON), MAKEINTRESOURCE(nIDResource)), things go wrong again. AfxFindResourceHandle calls AfxGetResourceHandle which also returns a NULL- or corrupt handle. X| So, my question is: How can I get the AfxGetInstanceHandle and AfxGetResourceHandle working well within my .dll?? Structured programming vs. chaotic mind boggling

    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