How to use third party dll at runtime with help of (dll) file path and procedure name
-
Sample dll code: Public Class SWTest Public Shared Sub kv() MsgBox("Code Project") End Sub End Class Please help me, how can i import this dll and call the procedure at runtime Note: My windows application only have the string inputs of (dll) file path and procedure name Example: Input1 = "D:\SWTest.dll" Input2 = "kv" Thanks KV
-
Sample dll code: Public Class SWTest Public Shared Sub kv() MsgBox("Code Project") End Sub End Class Please help me, how can i import this dll and call the procedure at runtime Note: My windows application only have the string inputs of (dll) file path and procedure name Example: Input1 = "D:\SWTest.dll" Input2 = "kv" Thanks KV
-
Sample dll code: Public Class SWTest Public Shared Sub kv() MsgBox("Code Project") End Sub End Class Please help me, how can i import this dll and call the procedure at runtime Note: My windows application only have the string inputs of (dll) file path and procedure name Example: Input1 = "D:\SWTest.dll" Input2 = "kv" Thanks KV
I believe you need to read up on Late Binding[^]
Steve Jowett ------------------------- Real programmers don't comment their code. If it was hard to write, it should be hard to read.
-
hi, i used your link sample, but i was got this error Value cannot be null. Parameter name: ptr FYI: Please download my sample project from this link http://www.2shared.com/file/4835939/1eaac353/RunTime_Dll.html[^] Note: Please send me any sample project attachment to my email id (to_velu@yahoo.co.in) if possible.
-
-
The method you are using (and was suggested in my link) works for ActiveX Dlls and OCX objects. First, have your class library a module not a class:
Public Module TestDll
Public Sub Test()
MsgBox("Hi")
End Sub
End ModuleThen use LoadLibrary to load the dll.
Delegate Sub Tst()
.
.
.
Static dll_loaded As Boolean, dll_handle As Int32, fn As tst
dll_handle = LoadLibrary("Testdll.dll")
msgfn = GetProcAddress(dll_handle, "Test")
msgfn.Invoke()By the way, why do you want to late-bind? Try using
Declare
which makes it much faster and more reliable!