PDA

View Full Version : How to detect if the DLL is loaded


yytg
12-25-2006, 05:18 PM
If you do something like this

LoadLibrary("MyDll");
LoadLibrary("MyDll");

The "MyDll" will load twice, I want so the DLL in the second time will refuse to load - How?

thanks in advance

Karen S. Garvin
12-26-2006, 02:36 PM
I don't understand why you are calling the library twice. If you don't want the second one to load, why not just delete it? :p

What are you trying to end up with?

yytg
12-26-2006, 04:41 PM
This is what I want to prevent

mentalhorse
12-26-2006, 05:13 PM
So you want it to check if it is loaded, and if it isn't try to load it again? And if not then not load it.
And you are using this (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/loadlibrary.asp)?


I think this would work

// Try the first time.
if(!LoadLibrary("MyDll")
LoadLibrary("myDll"); // Try a second time.

Is that what you mean?

yytg
12-28-2006, 11:19 AM
This is like a extension and I want so the program so will use me extenssion will be forced to load once
----
In the end I use Mutex

mentalhorse
12-28-2006, 03:02 PM
I don't understand that post.