[转贴]动态加载dll
我们都知道VB加载dll可以通过vb中引用来实现,可是需要动态引用呢?我通过摸索发现可以先regsvr32那个dll,然后在vb中createobject(dll插件为vb编译,若为标准dll,loadlibrary即可)。 详细代码如下程序代码:
Dim t As String Open "list.txt" For Input As #1 Open "reg.bat" For Output As #2 Do Until EOF(1) Input #1, t Print #2, "regsvr32 " & t & " /s" '注册控件 t = Replace(t, ".dll", "") List1.AddItem t Loop Close Close Shell ("reg.bat") '使用部分 Dim a As Object Dim b As String b = List1.Text & "startclass" Set a = CreateObject(List1.Text & "." & b) ‘工程名 + . +类名 a.run原帖地址:[url]http://www.[/url]