-
February 17th, 2022, 11:19 AM
#1
return dll if its exists
Hello, i'm trying to detect a "test.dll"(the name is just example) if it exists, and then to do my things in the code.The problem is, that whatever i do, "getmodulehandle" it always returns value null. I saw that, if the "test.dll" is detected, returns Windows Handle. I was searching on google for a solution but I couldn't find it. How to comparing the value if the example dll is found or if it's not? I'm sure there is something wrong in my example, but i cant understand what exactly. Can someone give me advice, how can i solve this? I'm pasting example code.
Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
Sub main()
If GetModuleHandle("test.dll") = true Then
Exit Sub
Else
Do other things
End if
End sub
-
February 17th, 2022, 03:34 PM
#2
Re: return dll if its exists
Before "searching on google for a solution" you must first read the documentation about the Win32 function you 'll be going to use:
https://docs.microsoft.com/en-us/win...tmodulehandlea
It is very clear that GetModuleHandle returns not a Boolean value but HMODULE!
Return value
If the function succeeds, the return value is a handle to the specified module.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
Victor Nijegorodov
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|