LONG ReuseDDElParam(lParam, msgIn, msgOut, uiLo, uiHi); | |||||
LONG lParam; | /* posted lParam to be reused | */ | |||
UINT msgIn; | /* ID for received message | */ | |||
UINT msgOut; | /* ID for posted message | */ | |||
UINT uiLo; | /* LOWORD of new lParam | */ | |||
UINT uiHi; | /* HIWORD of new lParam | */ |
The ReuseDDElParam function allows an application to reuse a packed DDE lParam, rather than allocating a new packed lParam. Using this function reduces realloctions when applications are passing packed DDE messages.
lParam
Specifies a posted DDE lParam that is being reused.
msgIn
Specifies the message ID for the received DDE message.
msgOut
Specifies the message ID for the DDE message to be posted that will use the reused lParam for packing.
uiLo
Specifies the LOWORD value to be packed into the reused lParam
uiHi
Specifies the HIWORD value to be packed into the reused lParam
If the function succeeds, the return value is non-zero.
The return value is to be posted as the lParam to a DDE message. The return value is not to be used for any other purpose. Once posted, there is no action required on the part of the posting application for disposal of this value.
If the function fails, the return value is zero.
This function should be used instead of the FreeDDElParam function if the lParam is going to be reused in a responding message. This function returns the lParam appropriate for reuse.
This function will allocate or free lParams as needed depending on the packing requirements of the incoming and outgoing messages. This reduces reallocations in passing DDE messages.
The following example shows a typical use of the ReuseDDEParam function:
#include <dde.h>
case WM_DDE_DATA:
UnpackDDElParam(WM_DDE_DATA, &uiLo, &uiHi);
fAckRequested = ProcessDataMsg(uiLo, uiHi);
if (fAckRequested) {
lParam = ReuseDDElParam(lParam, WM_DDE_DATA, WM_DDE_ACK,
0x8000, uiHi);
if (!PostMessage((HWND)wParam, WM_DDE_ACK,
hwnd, lParam)) {
GlobalDeleteAtom(uiHi);
FreeDDElParam(lParam);
}
}
else {
GlobalDeleteAtom(uiHi);
FreeDDElParam(lParam);
}
break;
FreeDDElParam, PackDDElParam, UnpackDDElParam