VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



A basic DDE Server that accepts LinkExecute commands

by Chui Tey (2 Submissions)
Category: DDE
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (9 Votes)

Demonstrates how to write a VB DDE Server that accepts DDEExecute command.

Rate A basic DDE Server that accepts LinkExecute commands

VB DDE Server


  • Create new VB project and name it Project1.
  • Set Form1.LinkTopic to "SYSTEM" and
  • Set Form1.LinkMode to "1 - Source"
  • Add the following code to the form

 

Option Explicit
Private Sub Form_LinkExecute(CmdStr As String, Cancel As Integer)
 MsgBox "Received " & CmdStr, vbInformation
 Cancel = False
End Sub 

Run the project

VB DDE Client

We'll now code up a client that calls DDE Execute on the server.


  • Create new VB project and name it Project2.
  • Add a textbox call "Text1"
  • Add a command button called "Command1" and
  • Add the following code to the form


Option Explicit
Private Sub Command1_Click()
 Text1.LinkMode = vbLinkNone
 Text1.LinkTopic = "Project1|SYSTEM"
 Text1.LinkMode = vbLinkManual
 Text1.LinkExecute "Hello World"
 
End Sub
 

Testing


Run the project.

 

When the form appears click on the button.
 Notice that the VB DDE Server has received 
 a string from the client and shown it on a 
 textbox.


Comments

DDE is a mechanism that is supported by a lot of applications. It can only handle simple strings, and is not as flexible or powerful as COM. However, some older applications only support DDE, and it is still necessary to code
DDE Servers.


Note on link topic


The link topic by default is the EXE name.
However, you can change this in the VBP file,
if you have a look at the key TITLE="...", this
key can be modified to use a different link topic.

Download this snippet    Add to My Saved Code

A basic DDE Server that accepts LinkExecute commands Comments

No comments have been posted about A basic DDE Server that accepts LinkExecute commands. Why not be the first to post a comment about A basic DDE Server that accepts LinkExecute commands.

Post your comment

Subject:
Message:
0/1000 characters