Okay, I created a resource-only DLL and I am trying to make an application that can load an image from it, such as a bitmap or icon.
Here is my DLL code:
Code:
#include "stdafx.h"
#ifdef _MANAGED
#pragma managed(push, off)
#endif
BOOL APIENTRY DllMain(HMODULE hModule,
DWORD ul_reason_for_call, LPVOID lpReserved)
{
return TRUE;
}
#ifdef _MANAGED
#pragma managed(pop)
#endif
Then Here is the Resource file include with it:
Code:
ICON_MAIN ICON "icon.ico"
This all compiles perfectly to a DLL. Then I can't seem to figure out how to load it into my project correctly.
Here is the code I use to load the icon image:
Code:
const char* pFileName="resdll.dll";
HMODULE hinstdll = LoadLibrary(pFileName);
HICON myicon = LoadIcon(hinstdll,ICON_MAIN);
FreeLibrary(hinstdll);
The program compiles without error if I remove the LoadIcon line, so that is my problem I suppose. When I try to compile I get the error:
"error C2065: 'ICON_MAIN' : undeclared identifier"
How can I fix this?