为什么这个VB6 ActiveX类会立即终止?

时间:2016-03-31 16:09:30

标签: class dll vb6 activex

给出以下(非常简单)的例子:

VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "Foo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Private Sub Class_Initialize()
    MsgBox "Initialized!"
End Sub

Private Sub Class_Terminate()
    MsgBox "Terminated! ( FFFUUUUUUUUU )"
End Sub

当我在另一个类中声明这个类并尝试实例化它时:

'Bar Class
Dim FooClassObject As Foo
Private Sub Class_Initialize( )
    FooClassObject = New Foo
End Sub

Foo被实例化,但随后立即终止。

为什么?

0 个答案:

没有答案