Resources such as Bitmap,Cursor,Icon etc can be attached to Win32/MFC projects as well as to DLL projects, really 🙂

Suppose we have a DLL Project, and as part of the project we have some resources. How can I call one function implemented in the DLL project from one calling project or application ??

Simple ??  really !!!..

you are right.. you can find a function named FindResource().

as from MSDN the description of FindResource() is as below

The FindResource function determines the location of a resource with the specified type and name in the specified module.

Happy  🙂 ???

Hope your problems are solved now

then what’s the problem??

Instead of default NULL argument , we must pass the Module Handle.

You can get the Module Handle by the function GetModuleHandle(NULL);

But unfortunately, GetModuleHandle(NULL) will return a handle of the calling process (.exe) which is not good for you. 😦



Just pass the name of the DLL in the GetModuleHandle();

for example GetModuleHandle(_T(“SampleDLL”);

HMODULE hMod = GetModuleHandle(_T("SampleDLL.dll"));
if(hSrc == NULL)
      return 0;