Admin Production ni-theme
Current Publication

BroadcastDDEDataReady

LabWindows/CVI

BroadcastDDEDataReady

int BroadcastDDEDataReady (char serverName[], char topicName[], char itemName[], unsigned int dataFormat, void *dataPointer, size_t dataSize);

Purpose

Allows your program, acting as a DDE server, to send data to all clients that have set up hot or warm links on the topic and item you specify.

When a client sets up a hot or warm link, your server callback function receives a DDE_ADVISELOOP message for a particular data object that corresponds to itemName. When the hot or warm link is terminated, your server callback function receives a DDE_ADVISESTOP message for the data object.

During the period when the hot or warm link is in effect, your server program is responsible for notifying the client whenever the value of the data object changes. When the data object value changes, your server program should call BroadcastDDEDataReady or AdviseDDEDataReady.

BroadcastDDEDataReady differs from AdviseDDEDataReady in that it is not restricted to a particular client. BroadcastDDEDataReady sends the data automatically to all clients with hot links to the item. BroadcastDDEDataReady notifies all clients with warm links to the item. For each warm–linked client that requests the data, the DDE_REQUESTDATA message invokes your server callback function. You must call ServerDDEWrite in the callback to send the data.

If successful, BroadcastDDEDataReady returns the number of bytes sent. Otherwise, BroadcastDDEDataReady returns a negative error code.

Note  Your program should not call BroadcastDDEDataReady in a tight loop because the iterations compete with user interface events for the CPU time. You should use BroadcastDDEDataReady sparingly and only when the value of the hot– or warm–linked data object changes. In cases when the server returns large data objects, your program should call BroadcastDDEDataReady only when the user interface is not busy.

Parameters

Input
Name Type Description
serverName char [] The server from which you want to broadcast DDE data.

The name must be a string of length from 1 to 255. serverName is case insensitive.
topicName char [] Topic name of the conversations for which you want to broadcast the data. Each server defines its own set of valid topic names. The clients specify the topic names when the clients connect to servers. In this case, the topic name should match the topic name for at least one active conversation with a client.

The name must be a string of length from 1 to 255. topicName is case insensitive.
itemName char [] The name identifying the object to which the data refers. Each server defines its own set of valid item names.

The name must be a string of length from 1 to 255. itemName is case insensitive.
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.
dataPointer void * The pointer to the data to be written.

NULL is not allowed unless dataSize is zero.
dataSize size_t The number of bytes in the data to be written.

An error is returned if you pass a value greater than INT_MAX.

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 4.0 and later