2

I'm trying to embed a GIF into my plugin but I'm failing to get the resource; this is what I'm doing:

HMODULE hModule = GetModuleHandle(NULL);
HRSRC hResInfo = FindResource(hModule, MAKEINTRESOURCE(201), L"GIF");

That is into the OnPluginReady() event, this is the firebreathWin.rc:

IDB_BITMAP1             GIF                     "C:/loader.gif"

And this into the resource.h:

#define IDB_BITMAP1                     201

The exact same procedure, is working on a console application; but not in my firebreath project.

Using, Visual C++ 2010.

  • `HMODULE hModule; GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, L"myDll.dll", &hModule); HRSRC hResInfo = FindResource(hModule, MAKEINTRESOURCE(201), L"GIF");` I've solved the problem that way in case someone needs a solution. – Maximiliano Santa Cruz Mar 09 '12 at 18:08

1 Answers1

1

If you look at dllmain.cpp you'll see that there is a global HINSTANCE gInstance that you can use:

extern HINSTANCE gInstance;
HRSRC hRes = FindResource(gInstance, MAKEINTRESOURCE(201), L"GIF");

You can also get the full path and filename of your dll pretty easily from FireBreath if you want to use the other method so that you aren't depending on your filename never changing.

taxilian
  • 14,229
  • 4
  • 34
  • 73