B
B
BelBES2018-02-18 16:53:55
C++ / C#
BelBES, 2018-02-18 16:53:55

How to load resource in dynamic library on Windows?

The following question arose:
I have a dynamically assembled library (.dll) which contains resource data inside.
To load resources, I use code like this inside the library:

hrsrc = ::FindResource(GetModuleHandle(NULL), <resource_name>, <resource_type>);

But, as far as I understand, GetModuleHandle(NULL) returns the handle not of the library, but of the application that calls it, in which the corresponding resource is missing.
Maybe someone knows how to correctly implement resource loading inside a dynamic library?
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
none7, 2018-02-18
@BelBES

DllMain entry point . The hinstDLL parameter is the HINSTANCE of your library, which should be used instead of GetModuleHandle(NULL).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question