Article ID: 102571 - Last Review: November 21, 2006 - Revision: 4.2 INFO: Calling DdePostAdvise() from XTYP_ADVREQThis article was previously published under Q102571 SUMMARY
The documentation for DdePostAdvise() in the Windows 3.1 Software
Development Kit "Programmer's Reference, Volume 2: Functions" states
the following in the Comments section:
If a server calls DdePostAdvise() with a topic/item/format name set that includes the set currently being handled in an XTYP_ADVREQ callback, a stack overflow may result. MORE INFORMATION
This is merely a warning against calling DdePostAdvise() from within a
DDE callback function's XTYP_ADVREQ transaction, because it may result
in a stack overflow.
Like window procedures, DDE callbacks must be coded with care to avoid infinite recursion (eventually resulting in a stack overflow). Because DdePostAdvise() causes DDEML to send an XTYP_ADVREQ transaction to the calling application's DDE callback function, calling DdePostAdvise() on the same topic/item/format name set as the one currently being handled results in an infinite loop. An analogous piece of code that has become a classic problem in Windows programming involves calling UpdateWindow() in a WM_PAINT case: case WM_PAINT:
InvalidateRect (hWnd, NULL, TRUE);
UpdateWindow (hWnd);
Calling UpdateWindow() as in the code above causes a WM_PAINT message to be sent to a window procedure, and thus results in the same type of infinite recursion that occurs when calling DdePostAdvise() from an XTYP_ADVREQ transaction. An example of a situation that would lend itself to this scenario would be one where data needs to be updated as a result of a previous data change. There are two ways to work around the stack overflow problem in this case:
DDEML and CBR_BLOCK APPLIES TO
| Article Translations
|
Back to the top
