Public Function DLLOCX(ByVal hwnd As Long, ByVal Path As String, ByVal Register As Boolean) As Boolean
On Error Resume Next
Dim LB As Long, PA As Long
Dim L As String
Dim LP As String
LB = LoadLibrary(Path)
If LB = 0 Then Exit Function
LP = "1"
L = "000000"
PA = GetProcAddress(LB, "Connect(" & LP & ",9600,30000," & L & ")")
If PA = 0 Then GoTo 0
Call CallWindowProc(PA, hwnd, ByVal 0&, ByVal 0&, ByVal 0&)
DLLOCX = True
0
End Function
Private Sub Command1_Click()
Call DLLOCX(1, App.Path & "\DrvMercFR.dll", False)
Call FreeLibrary(LoadLibrary(App.Path & "\DrvMercFR.dll"))
End Sub
|