Admin Production ni-theme
Current Publication

SetUpDDEHotLink

LabWindows/CVI

SetUpDDEHotLink

int SetUpDDEHotLink (unsigned int conversationHandle, char itemName[], unsigned int dataFormat, unsigned int timeOut);

Purpose

Allows your program, acting as a DDE client, to set up a hot link with the server. The hot link applies to the data object specified in itemName. If the server grants the request for the hot link, the server notifies your program whenever the value of the data object changes. When your program receives this notification, it invokes your client callback function with a DDE_DATAREADY message.

Note  The DDE Support Library makes no distinction between warm links and hot links. In both cases, the data is received immediately through the client callback function.

SetUpDDEHotLink returns zero for success or a negative error code for failure.

Parameters

Input
Name Type Description
conversationHandle unsigned int The conversation handle that uniquely represents the connection between the server and the client.
itemName char [] The name identifying the data object for which the hot link is being requested. The server defines the set of valid item names.

The name must be a string of length from 1 to 255. itemName is case insensitive.

Whenever the value of the data object is modified at the server site, your client callback function is called with a DDE_DATAREADY message.

itemName identifies the information in the server application to which the DDE link applies. For example, the item name can represent an Excel range of cells by using the range description R1C1:R10C10.

Note    To the client, LabWindows/CVI does not distinguish between a hot link and a warm link. For both types of links, the DDE Support Library calls the client callback function with a DDE_DATAREADY message when the data item changes at the server site. The new data is available in the dataPtr parameter of the callback function. LabWindows/CVI has two different functions for setting up a warm link or hot link in case some applications accept only one or the other kind of link.
dataFormat unsigned int One of the data formats Microsoft Windows recognizes. Windows supports the following valid data formats:

CF_TEXT
CF_BITMAP
CF_METAFILEPICT
CF_SYLK
CF_DIF
CF_TIFF
CF_OEMTEXT
CF_DIB
CF_PALETTE
CF_PENDATA
CF_RIFF
CF_WAVE
CF_OWNERDISPLAY
CF_DSPTEXT
CF_DSPBITMAP
CF_DSPMETAFILEPICT


Refer to www.msdn.com for more information about DDE programming and the meaning of each data format type.
timeOut unsigned int The number of milliseconds to wait for a DDE read or write operation to complete.

If a value of zero is passed, then a default timeout of 5000 milliseconds is used.

Return Value

Name Type Description
status int Return value indicating whether the function was successful.

A negative number represents the error code. For functions that read or write data (ClientDDERead, ClientDDEWrite, ServerDDEWrite, AdviseDDEDataReady, BroadcastDDEDataReady), if the function was successful, the return value is the number of bytes transferred. For other DDE Support Library functions, zero represents successful execution.

The enumerated type that specifies the absolute values of the error codes is declared in ddesupp.h. For instance, if an invalid parameter is passed, kDDE_InvalidParameter is returned.

Currently, a maximum of 255 concurrent conversations are allowed at any one time. If you exceed this limit, –kDDE_TooManyConversations will be returned.

Error codes from –16 to –33 are native DDEML errors, which correspond to Windows DDE error codes starting from 0x4000.

Additional Information

Library: DDE Support Library

Include file: ddesupp.h

LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later