VB.Net中动态调用dll解决思路

   阅读
VB.Net中动态调用dll
想要在VB.net当中动态的调用dll
目前的思路是通过静态引用kernel32.dll,调用LoadLibrary,GetProcAddress,获得地址之后,将地址给一个函数,完成调用。
这个思路在BCB中实现了,但是不知道在VB.net中如何实现,VB.net好像没有地址的概念,望大家多多指点,应该如何实现呢?

------解决方案--------------------
VB.NET code
    Declare Function LoadLibrary Lib "kernel32" Alias _
          "LoadLibraryA" (ByVal lpLibFileName As String) As Integer
    Declare Function FreeLibrary Lib "kernel32" Alias _
          "FreeLibrary" (ByVal hLibModule As Integer) As Integer
    Declare Function GetProcAddress Lib "kernel32" Alias _
          "GetProcAddress" (ByVal hModule As Integer, _
          ByVal lpProcName As String) As Integer
    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim hLib As Integer = LoadLibrary("CMPPAPI.dll")
        Dim apiaddress As Integer = GetProcAddress(hLib, _
                        "InitCMPPAPI")
    End Sub

------解决方案--------------------
探讨
dim objAssembly As [Assembly] = [Assembly].LoadFrom(XXX.dll)

Dim objType As Type = objAssembly.GetType(函数所在的类)

Dim objAdapter As Object = Activator.CreateInstance(objType)

Dim objMethodInfo As System.Reflection.MethodInfo = objType.GetMethod(函数名)

Dim objResult As Object = objMethodInfo.Invoke(objAdapter, 参数配列)

------解决方案--------------------
http://www.cnblogs.com/freeliver54/archive/2008/01/28/1055994.html
这里有篇文章,就是楼主要找的!
阅读