See if dll exist
-
Hi, How can I check if a dll exist in c++ before I try to load it with dllHandle = LoadLibraryW(m_sFileName)? Sometimes it looks like that the LoadLibraryW call hangs the calling thread if the dll doesn't exist on the disc. Regards Olof
I think you can use the API PathFileExists() to check wheather a file exist or not in disk. http://msdn.microsoft.com/en-us/library/bb773584%28v=vs.85%29.aspx[^] But according msdn loadlibrary function will return with fail if it wont find the file specified dll.
-
Hi, How can I check if a dll exist in c++ before I try to load it with dllHandle = LoadLibraryW(m_sFileName)? Sometimes it looks like that the LoadLibraryW call hangs the calling thread if the dll doesn't exist on the disc. Regards Olof
If you a priori know where the DLL should be then your strategy might be good. On the other hand if you need to follow the same procedure the OS does for searching the DLL then you'll meet the same hanging conditions, I suppose. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Hi, How can I check if a dll exist in c++ before I try to load it with dllHandle = LoadLibraryW(m_sFileName)? Sometimes it looks like that the LoadLibraryW call hangs the calling thread if the dll doesn't exist on the disc. Regards Olof
It's probably more important to investigate why the program hangs.
LoadLibrary()
should merely search through all paths in thePATH
variable to find the named DLL. If it hangs during that process then there is something wrong with your system.I must get a clever new signature for 2011.
-
I think you can use the API PathFileExists() to check wheather a file exist or not in disk. http://msdn.microsoft.com/en-us/library/bb773584%28v=vs.85%29.aspx[^] But according msdn loadlibrary function will return with fail if it wont find the file specified dll.
-
It's probably more important to investigate why the program hangs.
LoadLibrary()
should merely search through all paths in thePATH
variable to find the named DLL. If it hangs during that process then there is something wrong with your system.I must get a clever new signature for 2011.
-
Hi, the problem occurs when the user do sleep/resume test with the computer. We try to load the dll with LoadLibrary and a few milliseconds after the LoadLibrary call the user puts the system into sleep. Maybe thats why I got the problem?
-
This is a joke, right? You really expect your program to continue running when the OS enters sleep mode?
I must get a clever new signature for 2011.
Of cours not, are you stupid or??? It very difficult to know when the user puts the system into sleep. And I don't see the meaning of your comment, you have no idea how big our application is and how it work. The application stops working ~1/100 sleep resume tests. Thanks for your answer!
-
Of cours not, are you stupid or??? It very difficult to know when the user puts the system into sleep. And I don't see the meaning of your comment, you have no idea how big our application is and how it work. The application stops working ~1/100 sleep resume tests. Thanks for your answer!
marca292 wrote:
are you stupid or?
No, how about you?
marca292 wrote:
ou have no idea how big our application is and how it work.
I did not say I did?
marca292 wrote:
The application stops working ~1/100 sleep resume tests.
I have no idea what this is supposed to mean.
I must get a clever new signature for 2011.