Tools.h++ Class Reference

Table Of Contents
GlobalFree(hMem);
GlobalDeleteAtom(aItem);
return FALSE;
}
return TRUE;
}
The handle of the DDE server is passed in as parameter hwndServer, the handle of the client as
parameter hwndClient. An ostream is created, using an RWDDEstreambuf as its associated
streambuf. The results can be used much like any other ostream, such as cout, except that
characters will be inserted into Windows global memory, from where they can be transferred
through the DDE. Note the parameters used in the constructor. These should be studied below
as they have important ramifications on how memory allocations are handled through the DDE.
In particular, parameter fRelease, if TRUE, states that the client will be responsible for
deallocating the memory when done. The defaults also specify fAckReq TRUE, meaning that
the client will acknowledge receiving the message: you must be prepared to receive it.
Some text and a double is inserted into the ostream. Member function str() is then called which
unlocks and returns a Windows HANDLE. Once we have called str(), we are responsible for
this memory and must either free it when done, or pass on that responsibility to someone else.
In this case, it will be passed on to the client.
An atom is then constructed to identify the data. The DDE data, along with its identifying atom,
is then posted. If the post fails, then we have been unable to foist our responsbility for the global
memory onto someone else and will have to free it (along with the atom) ourselves.
Public Constructors
RWDDEstreambuf(WORD cfFormat = CF_TEXT,
BOOL fResponse = TRUE
BOOL fAckReq = TRUE
BOOL fRelease = TRUE);
Constructs an empty RWDDEstreambuf in dynamic mode. The results can be used
anywhere any other streambuf can be used. Memory to accomodate new characters will
be allocated as needed.
The four parameters are as defined by the Windows Reference, Volume 2 (in particular,
see the section DDE Message Directory). Parameter cfFormat specifies the format of the
data being inserted into the streambuf. These formats are the same as used by
SetClipboardData(). If a specializing virtual streams class such as RWbostream or
RWpostream is used to perform the actual character insertions instead of a simple
ostream, the format may not be so simple. In this case, the user might want to register his
or her own format, using the Windows function RegisterClipboardFormat().
For the meaning of the other three parameters see below, and/or the Windows reference
manuals.