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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. COM
  4. ATL COM DLL and Bitmaps

ATL COM DLL and Bitmaps

Scheduled Pinned Locked Moved COM
helpc++comgraphicstutorial
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.
  • R Offline
    R Offline
    Ranjan Banerji
    wrote on last edited by
    #1

    I am trying to create a visualization for the Windows Media Player. The SDK comes with a wizard that creates an ATL class for a COM DLL with the appropriate interfaces etc. One of the functions is Render which is passed a HDC. Using the HDC one can draw whatever visualization. All this works fine. Now I want to display some bitmaps. So in the DLL I added a Bitmap into the resource by importing a picture. Then I am trying to use LoadBitmap or LoadImage. Both fail. I get the following error when I call GetLastError: 1814: The specified resource name cannot be found in the image file. I am assuming I am getting this because I do not have the propoer HINSTANCE for the call to LoadImage or LoadBitmap. I am using a NULL not knowing how to get the HINSTANCE for the media player. Or should it be one for the DLL? Now I am all confused..... help........ Thanks...

    R T 2 Replies Last reply
    0
    • R Ranjan Banerji

      I am trying to create a visualization for the Windows Media Player. The SDK comes with a wizard that creates an ATL class for a COM DLL with the appropriate interfaces etc. One of the functions is Render which is passed a HDC. Using the HDC one can draw whatever visualization. All this works fine. Now I want to display some bitmaps. So in the DLL I added a Bitmap into the resource by importing a picture. Then I am trying to use LoadBitmap or LoadImage. Both fail. I get the following error when I call GetLastError: 1814: The specified resource name cannot be found in the image file. I am assuming I am getting this because I do not have the propoer HINSTANCE for the call to LoadImage or LoadBitmap. I am using a NULL not knowing how to get the HINSTANCE for the media player. Or should it be one for the DLL? Now I am all confused..... help........ Thanks...

      R Offline
      R Offline
      Ranjan Banerji
      wrote on last edited by
      #2

      Finally got it. I needed to use _Module.GetResourceInstance()

      1 Reply Last reply
      0
      • R Ranjan Banerji

        I am trying to create a visualization for the Windows Media Player. The SDK comes with a wizard that creates an ATL class for a COM DLL with the appropriate interfaces etc. One of the functions is Render which is passed a HDC. Using the HDC one can draw whatever visualization. All this works fine. Now I want to display some bitmaps. So in the DLL I added a Bitmap into the resource by importing a picture. Then I am trying to use LoadBitmap or LoadImage. Both fail. I get the following error when I call GetLastError: 1814: The specified resource name cannot be found in the image file. I am assuming I am getting this because I do not have the propoer HINSTANCE for the call to LoadImage or LoadBitmap. I am using a NULL not knowing how to get the HINSTANCE for the media player. Or should it be one for the DLL? Now I am all confused..... help........ Thanks...

        T Offline
        T Offline
        Todd Harvey
        wrote on last edited by
        #3

        in your DLLMain myBitmap = LoadBitmap( hInstance , MAKEINTRESOURCE( IDB_MY_BITMAP); and in your control class, or wherever you need it, do an extern HBITMAP myBitmap; There may be other ways.

        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