vb.netcom对象 vb属性窗口怎么打开

VB 控件使用问题,高手请进用CreateObject方法创建控件,或者把对应的文件打包在同一目录,或者打包进程序里面待使用的时候再动态释放出来 , 还有两种动态调用的方法可供参考:
(1)VB使用未注册的ActiveX代码
''IDE下可以引用那个dll使用 。编译后可以在未注册dll的计算机上正常工作了 。
''使用方法:
''Dim pDll As Long ''记录Dll,用来最后完美释放
''Dim Update As Update.Handle ''要实例化的对象
''Set Update = LoadObjectByName(App.Path"Update.dll", "Handle", pDll) '' New Update.Handle
''If Update Is Nothing Then Exit Sub
''Update.Test ''--类中的方法
''Set Update = Nothing ''-----这句不能少,否则会出现意外错误
''UnLoadDll pDll ''----释放
''模块中:
Option Explicit
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryW" (ByVal lpLibFileName As Long) As Long
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Declare Function CallAsmCode Lib "user32" Alias "CallWindowProcW" (FirstAsmCode As Long, ByVal pA As Long, ByVal pB As Long, ByVal pC As Long, lpD As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private AsmCode(94) As Long
Function LoadObjectByName(ByVal DllPath As String, ByVal ClsName As String, pDll As Long) As Object
Dim pObj As Long, TLIAPP As Object, TLI As Object
Dim CLSID As String, IID As String, IIDName As String
On Error GoTo Err
Set TLIAPP = CreateObject("TLI.TLIApplication")
Set TLI = TLIAPP.TypeLibInfoFromFile(DllPath)
IIDName = "_"Trim(ClsName)
CLSID = TLI.GetTypeInfo(Trim(ClsName)).GUID
IID = TLI.GetTypeInfo(Trim(IIDName)).GUID
Set LoadObjectByName = LoadObjectByID(DllPath, CLSID, IID, pDll)
Set TLI = Nothing
Err:
End Function
Function LoadObjectByID(ByVal DllPath As String, ByVal CLSID As String, ByVal IID As String, pDll As Long) As Object
Dim pObj As Long
Call InitAsmCode
pObj = CallAsmCode(AsmCode(20), StrPtr(DllPath), StrPtr(CLSID), StrPtr(IID), pDll)
CopyMemory LoadObjectByID, pObj, 4
End Function
Function UnLoadDll(pDll As Long) As Long
Call InitAsmCode
UnLoadDll = CallAsmCode(AsmCode(79), pDll, 0, 0, 0)
End Function
Private Sub InitAsmCode()
If AsmCode(4) Then Exit Sub
Dim pDll As Long
pDll = LoadLibrary(StrPtr("kernel32"))
AsmCode(0) = GetProcAddress(pDll, "LoadLibraryW")
AsmCode(1) = GetProcAddress(pDll, "GetProcAddress")
AsmCode(2) = GetProcAddress(pDll, "FreeLibrary")
Call FreeLibrary(pDll)
AsmCode(4) = H476C6C44
AsmCode(5) = H6C437465
AsmCode(6) = H4F737361
AsmCode(7) = H63656A62
AsmCode(8) = H4C430074
AsmCode(9) = H46444953
AsmCode(10) = H536D6F72
AsmCode(11) = H6E697274
AsmCode(12) = H10067
AsmCode(13) = H0
AsmCode(14) = HC00000
AsmCode(15) = H0
AsmCode(16) = H6F4600
AsmCode(17) = H65006C
AsmCode(18) = H320033
AsmCode(19) = H0
AsmCode(20) = H83EC8B55 ''创建对象函数入口
AsmCode(21) = HE853D8C4
AsmCode(22) = H0
AsmCode(23) = H6CEB815B
AsmCode(24) = H8D100010
AsmCode(25) = H105293
AsmCode(26) = H93FF5210
AsmCode(27) = H10001010
AsmCode(28) = H32938D50
AsmCode(29) = H52100010
AsmCode(30) = H1493FF50
AsmCode(31) = H8D100010
AsmCode(32) = H101C93
AsmCode(33) = HFF028910
AsmCode(34) = H101893
AsmCode(35) = H875FF10
AsmCode(36) = H101093FF
AsmCode(37) = HC00B1000
AsmCode(38) = H86840F
AsmCode(39) = H45890000

推荐阅读