beautypg.com

Dde example – HP Integrity NonStop J-Series User Manual

Page 80

background image

Click on the banner to return to the user guide home page.

©Copyright 1996 Rogue Wave Software

DDE Example

Let's look at a more complicated example of how you might use class

RWDDEstreambuf

to

exchange an

RWBinaryTree

through the Windows DDE facility. You would use a similar

technique for the Windows Clipboard.

#include
#include
#include
#include
#include
#include

BOOL
PostCollection(HWND hwndServer, WORD cFormat){
RWBinaryTree sc; // 1
sc.insert(new RWCollectableString("Mary"));
sc.insert(new RWCollectableString("Bill"));
sc.insert(new RWCollectableString("Pierre"));

// Allocate an RWDDEstreambuf and use it to initialize
// an RWbostream:
RWDDEstreambuf* sbuf = new RWDDEstreambuf(cFormat, // 2
FALSE, // 3
TRUE, // 4
TRUE); // 5
RWbostream bostr( sbuf ); // 6

// Store the collection to the RWbostream:
bostr << sc; // 7

// Lock the output stream, and get its handle:
HANDLE hDDEData = sbuf->str(); // 8

// Get an atom to identify the DDE Message:
ATOM atom = GlobalAddAtom("SortedNames"); // 9

This manual is related to the following products: