I have an MFC dll with is used in an application.This Dll doesn't have DLLMain function.Now how do i retrieve hinstance of the said dll with in the dll?I am using VS 2010.
Asked
Active
Viewed 248 times
-1
-
Doesn't [AfxGetInstanceHandle](https://msdn.microsoft.com/en-us/library/36z3tfsb(v=vs.100).aspx) work for you? – Roger Rowland Dec 24 '15 at 06:49
-
no not working.i tried all the methods specified in this form – nagaraj sherigar Dec 24 '15 at 07:03
-
1Possible duplicate of [How do I get the HMODULE for the currently executing code?](http://stackoverflow.com/questions/557081/how-do-i-get-the-hmodule-for-the-currently-executing-code) – IInspectable Dec 24 '15 at 14:23
1 Answers
1
GetModuleHandle function will return the HINSTANCE of the dll or the exe. Pass the name of your dll as the first argument.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683199(v=vs.85).aspx

EylM
- 5,967
- 2
- 16
- 28