Search code examples
c#c++winapidllcom

Checking if a WIN32 / Unmanaged DLL is loaded from a COM module on runtime


I want to check if a native dll is already loaded from a COM Module? My purpose is to check if the appropriate DLL is loaded so that I can call the corresponding methods on it. I referred the link "https://msdn.microsoft.com/en-us/library/system.appdomain.getassemblies.aspx" but it did not help. My native module is also not shown in the Loaded Module list window in visual studio during debugging but it is shown when I set "Enable native code debugging"? is there a way to achieve the same through code?


Solution

  • Call GetModuleHandle passing the module's name. If the module is loaded in your process, a non-null value is returned.