我做了的DLL,代码如下:
类名:clsTest
Option Explicit
Public Event evTell(ByVal nGun As Integer)
Dim strTest   As String
Public Property Get strShow() As String
   strShow = strTest
End PropertyPublic Property Let strShow(ByVal NewValue As String)
      strTest = NewValue
End PropertyPublic Sub Tell(ByVal nGun As Integer)
      RaiseEvent evTell(nGun)
      strTest = nGun
End SubPrivate Sub Class_Initialize()
   strTest = "Start"
End Sub
应用程序1引用了该DLL后,在form1中代码为:
Option Explicit
Dim WithEvents TemN  As clsTest
Private Sub Command1_Click()                 '这是个命令按钮1
  TemN.Tell (1)
End SubPrivate Sub Form_Load()
  Set TemN = New clsTest
End SubPrivate Sub TemN_evTell(ByVal nGun As Integer)
  MsgBox "P1:  " &  nGun
End SubPrivate Sub Command2_Click()        '命令按钮2
  TemN.strShow = "Che Show"
End Sub应用程序2代码:
Option Explicit
Dim WithEvents TemN  As clsTest
Private Sub Command1_Click()      '应用程序2的按钮
  MsgBox TemN.strShow
End SubPrivate Sub Form_Load()
  Set TemN = New clsCheInfo
End SubPrivate Sub TemN_evTell(ByVal nGun As Integer)
  MsgBox "P2:" &  nGun
End Sub测试时:应用程序1按按钮1后,出现提示“P1:1”,应用程序2无提示
        应用程序1按按钮2后,应用程序2按按钮仍然提示是“Start”
我想,这是因为两个应用程序采用了不同的实例的原因,但要实现按应用程序1按钮1后,应用
程序2能得知,及应用程序1修改了strTest的值后,应用程序2能得到这个改变的值,该如何实现呢?