put this code in every class that you need to use GetObject on in your dll and change VegaCOMM.clsSocket to yourprojectname.classname
That should do it.
Code:' Declares needed to register object in the ROT Private Const ACTIVEOBJECT_STRONG = 0 Private Const ACTIVEOBJECT_WEAK = 1 Private Declare Function CLSIDFromProgID Lib "ole32.dll" (ByVal ProgID As Long, rclsid As GUIDs) As Long Private Declare Function CoDisconnectObject Lib "ole32.dll" (ByVal pUnk As IUnknown, pvReserved As Long) As Long Private Declare Function RegisterActiveObject Lib "oleaut32.dll" (ByVal pUnk As IUnknown, rclsid As GUIDs, ByVal dwFlags As Long, pdwRegister As Long) As Long Private Declare Function RevokeActiveObject Lib "oleaut32.dll" (ByVal dwRegister As Long, ByVal pvReserved As Long) As Long Private OLEInstance As Long Private Sub Class_Initialize() Dim typGUID As GUIDs Dim lp As Long OLEInstance = 0 ' This code is responsible for creating the entry in the rot lp = CLSIDFromProgID(StrPtr("VegaCOMM.clsSocket"), typGUID) If lp = 0 Then lp = RegisterActiveObject(Me, typGUID, ACTIVEOBJECT_WEAK, OLEInstance) End If End Sub Private Sub Class_Terminate() ' Once we are done with the main program, lets clean up the rot ' by removing the entry for our ActiveX Server If OLEInstance <> 0 Then RevokeActiveObject OLEInstance, 0 End If CoDisconnectObject Me, 0 End Sub




Reply With Quote