下面的代码在一定程度上可以防止另一个副本重复运行,但是当已运行的副本处于托盘状态,或者副本的Form.comption=""时,无法AppActivate窗体。我试了一下老马的一个模块,也是无法解决这个问题,请问有什么方法可以解决这个问题,尤其是托盘状态的问题。
有一个朋友说用DDE,小弟没用过DDE,不知道怎么用,希望有例子的朋友提供一下,谢谢。Private Sub Form_Load()
Dim K As Long
'不准重复打开这个程序
Dim title As String
If App.PrevInstance Then
title = App.title
App.title = " "
Me.Caption = " "
AppActivate title
End
End If
End Sub
有一个朋友说用DDE,小弟没用过DDE,不知道怎么用,希望有例子的朋友提供一下,谢谢。Private Sub Form_Load()
Dim K As Long
'不准重复打开这个程序
Dim title As String
If App.PrevInstance Then
title = App.title
App.title = " "
Me.Caption = " "
AppActivate title
End
End If
End Sub
http://www.symental.com/sfw?f=ddeshowform
偷懒,能短则短 ^_^ ),把已有的一个窗体的“LinkTopic”属性改为“FormDDE”,把“LinkMode”
属性改为“1 - Source”,添加一个PictureBox控件作为DDE执行控件,命名为picDDE。然后添加一个
TextBox控件,命名为“txtInfo”,并把“MultiLine”属性设置为“True”,以便显示多行文本,作为
消息显示控件我按照这个方法做了,但是运行的时候,提示无外部程序响应DDE