The information in this article applies to:
SYMPTOMSWhen implementing DDEML from an implicitly-loaded dynamic-link library (DLL), calling DdeInitialize() from the DLL's LibMain() function causes the DdeInitialize() call to fail (that is, results to an exception 13). Moving the call to DdeInitialize() anywhere other than LibMain() corrects the problem. CAUSEIn DdeInitialize(), DDEML initializes its data structures, allocates memory, and also creates windows (for its own internal use). This, of course, causes messages to be sent to the application's message queue, which at LibMain() time, in an implicitly-loaded DLL, does not exist yet. These messages sent to a non-existent message queue result to an exception 13. RESOLUTION
One way to resolve this problem is to export another function in the DLL,
call it InitDDEML(), which can call DdeInitialize() and perform all
necessary initializations. This guarantees that when the function
InitDDEML() is called, the application's message queue has been properly
initialized.
MORE INFORMATION
Because an implicitly-loaded DLL is loaded into memory before the calling
application is completely loaded, LibMain(), [which is analogous to an
application's WinMain()] is called before the application's message queue
is initialized. As a result, the DLL must not call functions that send
messages to the application in LibMain().
Additional query words: 3.10 3.1
Keywords : kb16bitonly |
Last Reviewed: November 4, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |