LinkExecute Event

See Also62AFZ6              Example31R3SW0>Low

Applies To

Form14TJ2LN, MDI Form1ILMZQ7.

Description

Occurs when a command string is sent by a destinationHF8UZ8 application in a DDE conversation. The destination application expects the sourceO9K12R application to perform the operation described by the string.

Syntax

SubForm|MDIForm}_LinkExecute (CmdStr As String, Cancel As Integer)

Remarks

The LinkExecute event uses these arguments:

Argument     Description

 

CmdStr          The command string sent by the destination application.

Cancel           This argument's value at the end of the LinkExecute event procedure tells the destination whether the command string was accepted or refused.  Setting Cancel = 0 informs the destination that the command string was accepted.  Setting Cancel to any nonzero value informs the destination that the command string was rejected.  (The default is set to -1, indicating Cancel.)

 

There is no required syntax for CmdStr.  How your application responds to different strings is completely up to you.

If you have not created a LinkExecute event procedure, Visual Basic rejects command strings from destination applications.


See Also

Help:

Attaching an Event Procedure to a Form or Control2LBGK4C

LinkClose Event17O5TU0

LinkError EventEGZX07

LinkExecute Method0JJE0GF

LinkMode PropertyM1RK6S

LinkNotify Event1PIR0GG

LinkOpen EventM1TL81

LinkTopic PropertyEVWV3S

Using DDEHOWDDE

 

Programmer's Guide:

Chapter 20, "Communicating with Other Applications"


LinkExecute Event Example

The example defines a set of commands for destinations to use in DDE conversations to which your application will respond.  This example is for illustration only.

Sub Form_LinkExecute (CmdStr As String, Cancel As Integer)

   Cancel = False

   Select Case LCase(cmdStr)

   Case "{ big}"

      WindowState = 2        ' Maximize window.

   Case "{ little}"

      WindowState = 1        ' Minimize window.

   Case "{ hide}"

      Visible = False        ' Hide form.

   Case "{ view}"

      Visible = True         ' Display form.

   Case Else

      Cancel = True          ' Execute not allowed.

   End Select

End Sub