Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to use third party dll at runtime with help of (dll) file path and procedure name

How to use third party dll at runtime with help of (dll) file path and procedure name

Scheduled Pinned Locked Moved Visual Basic
tutorialhelpquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kvelu d
    wrote on last edited by
    #1

    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

    M S 2 Replies Last reply
    0
    • K kvelu d

      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

      M Offline
      M Offline
      MohammadAmiry
      wrote on last edited by
      #2

      see http://www.omegajunior.net/code/vbnet_unmanaged.html[^]

      K 2 Replies Last reply
      0
      • K kvelu d

        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

        S Offline
        S Offline
        Steven J Jowett
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • M MohammadAmiry

          see http://www.omegajunior.net/code/vbnet_unmanaged.html[^]

          K Offline
          K Offline
          kvelu d
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • M MohammadAmiry

            see http://www.omegajunior.net/code/vbnet_unmanaged.html[^]

            K Offline
            K Offline
            kvelu d
            wrote on last edited by
            #5

            Download link http://www.2shared.com/file/4835939/1eaac353/RunTime\_Dll.html

            M 1 Reply Last reply
            0
            • K kvelu d

              Download link http://www.2shared.com/file/4835939/1eaac353/RunTime\_Dll.html

              M Offline
              M Offline
              MohammadAmiry
              wrote on last edited by
              #6

              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 Module

              Then 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!

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups