Private Sub MDIForm_Load()
If App.PrevInstance Then
frmMDI.LinkTopic = "" ' 这两行用于清除新运行的程序的DDE服务器属性,
frmMDI.LinkMode = 0
frmMDI.Picture1.LinkMode = 0 '--
frmMDI.Picture1.LinkTopic = "DDE|frmMDI" ' |______连接DDE程序并发送数据/参数
frmMDI.Picture1.LinkMode = 2 ' | “|”为管道符,是“退格键”旁边的竖线,
frmMDI.Picture1.LinkExecute Command
End ' 结束新程序的运行
End If
================================
Private Sub MDIForm_LinkExecute(CmdStr As String, Cancel As Integer)
frmMDI.Picture1.Tag = Command
Me.WindowState = 2
Me.SetFocus
Dim fso
Set fso = CreateObject("scripting.filesystemobject")
Dim dirx As String
dirx = Right(Command, Len(Command) - 1)
dirx = Left(dirx, Len(dirx) - 1)
If fso.FileExists(dirx) Then
CreateNewDocument
frmMDI.ActiveForm.rtfText.LoadFile dirx
frmMDI.ActiveForm.Caption = dirx
Else: MsgBox "不存在"
End If
Cancel = False ' '如果为TRUE 则客户端要出错
End Sub
最终终于成功 最后再次谢谢落花老大