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. Resource DLL

Resource DLL

Scheduled Pinned Locked Moved C / C++ / MFC
questionlearning
2 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.
  • F Offline
    F Offline
    Florin Ochiana
    wrote on last edited by
    #1

    Hi, I am trying to make a dll for the images in my project. In the dll's project I add the resources (bitmaps) and I have functions to return HICONs, HBITMAPs, etc. But I can't create any image resources in my dll. In my resource.h I have #define IDB_02 5001 but when I do CBitmap dd; BOOL ret = dd.LoadBitmap(IDB_02)); "ret" is false. Do I have to include something else in a dll to make it work with images? Thanks ----- We are what we repeatedly do. Excellence, then, is not an act, but a habit.

    R 1 Reply Last reply
    0
    • F Florin Ochiana

      Hi, I am trying to make a dll for the images in my project. In the dll's project I add the resources (bitmaps) and I have functions to return HICONs, HBITMAPs, etc. But I can't create any image resources in my dll. In my resource.h I have #define IDB_02 5001 but when I do CBitmap dd; BOOL ret = dd.LoadBitmap(IDB_02)); "ret" is false. Do I have to include something else in a dll to make it work with images? Thanks ----- We are what we repeatedly do. Excellence, then, is not an act, but a habit.

      R Offline
      R Offline
      Ryan Binns
      wrote on last edited by
      #2

      Before you call this, call AfxSetResourceHandle() to set the location of the resource, remembering to save the old one using AfxGetResourceHandle()

      HINSTANCE hOldRes = AfxGetResourceHandle();
      AfxSetResourceHandle(hinstDLL); // hinstDLL is the instance handle of your DLL
      CBitmap dd;
      BOOL ret = dd.LoadBitmap(IDB_02);
      AfxSetResourceHandle(hOldRes);

      Hope this helps, Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
      Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"

      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