|

楼主 |
发表于 2008-6-27 00:27:00
|
显示全部楼层
Re:告别VB6乱码 ( 增强 vb6内建字符串 + 我的字符串COM ) 源代
关于 COM 组件的注册,推荐使用我的代码:
Option Explicit
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Sub RegCom(file As String)
DllFunc file, "DllRegisterServer"
End Sub
Public Sub UnregCom(file As String)
DllFunc file, "DllUnregisterServer"
End Sub
Private Sub DllFunc(file As String, funcname As String)
Dim hdll As Long
Dim lpfn As Long
hdll = LoadLibrary(file)
lpfn = GetProcAddress(hdll, funcname)
CallWindowProc lpfn, 0, 0, 0, 0
End Sub |
|