DDEPoke statement - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Sends a data value to an item in a DDE server application.

Syntax

DDEPoke channel, itemname, data 

channel is an integer channel number returned by the DDEInitiate() function.

itemname is a string value representing the name of an item.

data is a character string to be sent to the item named in the itemname parameter.

Description

The DDEPoke statement stores the data text string in the specified DDE item.

The channel parameter must correspond to the number of a channel which was opened through the DDEInitiate() function.

The itemname parameter should identify an item which is appropriate for the specified channel. Different DDE applications support different item names; to learn what item names are supported by a particular Windows application, refer to the documentation for that application.

In a DDE conversation with Excel, a string of the form R1C1 (for Row 1, Column 1) is a valid item name. In a DDE conversation with another MapBasic application, the name of a global variable in the application is a valid item name.

Error Conditions

ERR_CMD_NOT_SUPPORTED (642) error generated if not running on Windows.

ERR_INVALID_CHANNEL (696) error generated if the specified channel number is invalid.

Example

If Excel is already running, the following example stores a simple message ("Hello from MapInfo!") in the first cell of an Excel worksheet.

Dim i_chan_num As Integer
i_chan_num = DDEInitiate("EXCEL", "Sheet1")
DDEPoke i_chan_num, "R1C1", "Hello from MapInfo!" 

The following example assumes that there is another MapBasic application currently in use-"Dispatch.mbx"-and assumes that the Dispatch application has a global variable called Address. The example below uses DDEPoke to modify the Address global variable.

i_chan_num = DDEInitiate("MapInfo","C:\DISPATCH.MBX")
DDEPoke i_chan_num, "Address", "23 Main St." 

See Also:

DDEExecute statement, DDEInitiate() function, DDERequest$() function