Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
B.S.D

Hello,

This is kind of a weird question.
I have a WinForms project. I added a reference to a DLL.
Inside the program I call GetModuleHandle on the DLL.
I get NULL, meaning that the DLL is not loaded (even though the program uses symbols from that DLL).

Can anyone explain this to me?

Thanks,
Elad
Posted

1 solution

IIRC GetModuleHandle won't work on managed Assemblies - they aren't "loaded" in the same way as unmanaged DLLs.

Try:
C#
IntPtr handle = Marshal.GetHINSTANCE(typeof(MyClass).Module);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900