怎样让放入ROT对象中的对象进程结束后,还可以共其他进程用
我有一个写的cab包,在ie上点击时调用cab中的一个方法,在ROT中加入一个对象,不关ie可以用GetObject(,""thtf.myRot")可以得到 ROT中放的对象,可关了ie就得不到了,ROT的对象不是跨进程的吗?需要什参数
Private Const ACTIVEOBJECT_STRONG = 0对象 ROT
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
Public Sub runExcel(Optional path_ As String = "")
Dim myRot_
On Error GoTo l
Set myRot_ = GetObject(, "thtf.myRot")
GoTo l1
l:
Set myRot_ = New myRot
Call addRot("thtf.myRot", myRot_)
l1:
'......
End Sub
Public Sub addRot(strName As String, up)
Dim mGuid As GUIDs
Dim lp As Long
OLEInstance = 0
lp = CLSIDFromProgID(StrPtr(strName), mGuid)
If lp = 0 Then
lp = RegisterActiveObject(up, mGuid, ACTIVEOBJECT_WEAK, OLEInstance)
End If
End Sub