Example of Client-Server DDE Between Visual Basic ApplicationsID: Q74861
|
This article outlines the steps necessary to initiate dynamic data
exchange (DDE) between a Microsoft Visual Basic destination application
and a Visual Basic source application.
This article demonstrates how to:
This information is included with the Help file provided with Microsoft
Professional Toolkit for Visual Basic version 1.0, Microsoft Visual Basic
version 2.0, and Microsoft Visual Basic version 3.0.
A destination application sends commands through DDE to the source
application to establish a link. Through DDE, the source provides data to
the destination at the request of the destination or accepts information
at the request of the destination.
Default Name Caption Name
-----------------------------------------
Text1 (Not applicable) Text1
Option1 Manual Link ManualLink
Option2 Automatic Link AutomaticLink
Command1 Poke Poke
Command2 Request Request
Const AUTOMATIC= 1
Const MANUAL = 2
Const NONE = 0
'(NOTE: For Visual Basic version 1.0, also add the following
' constants:
'Const True = -1
'Const False = 0
Sub Form_Load ()
'This procedure will start the VB source application.
z% = Shell("SOURCE", 1)
z% = DoEvents() 'Causes Windows to finish processing Shell command.
Text1.LinkMode = NONE 'Clears DDE link if it already exists.
Text1.LinkTopic = "Source|Form1" 'Sets up link with VB source.
Text1.LinkItem = "Text1" 'Set link to text box on source.
Text1.LinkMode = MANUAL 'Establish a manual DDE link.
ManualLink.Value = TRUE 'Sets appropriate option button.
End Sub
Sub ManualLink_Click ()
Request.Visible = TRUE 'Make request button valid.
Text1.LinkMode = NONE 'Clear DDE Link.
Text1.LinkMode = MANUAL 'Reestablish new LinkMode.
End Sub
Sub AutomaticLink_Click ()
Request.Visible = FALSE 'No need for button with automatic link.
Text1.LinkMode = NONE 'Clear DDE Link.
Text1.LinkMode = AUTOMATIC 'Reestablish new LinkMode.
End Sub
Sub Request_Click ()
'With a manual DDE link, this button will be visible, and when
'selected it will request an update of information from the source
'application to the destination application.
Text1.LinkRequest
End Sub
Sub Poke_Click ()
'With any DDE link, this button will be visible, and when it's
'selected, will poke information from the destination application
'into the source application.
Text1.LinkPoke
End Sub
DDE and Visual Basic
Additional query words: 2.00 3.00
Keywords :
Version :
Platform :
Issue type :
Last Reviewed: May 25, 1999