"Fortunate are those who take the first steps.” ― Paulo Coelho

About DDEInitialize and sometime lockup scenario explained.

I had a chance to work with Excel DDE call lockup Issue,

> The first step in establishing a DDE conversation is that the DDE client will send a WM_DDE_INITIATE message to one or more windows running on the same desktop as the DDE client process. The WM_DDE_INITIATE message is a query to each window receiving the message to determine whether the process that owns the window supports the specified application name and topic. Typically, a DDE client will broadcast the WM_DDE_INITIATE message to all top level windows (both visible and hidden) running on the same desktop, looking for any running process that supports the specified application name and topic.

The implementation of the Excel DDEInitiate function broadcasts the WM_DDE_INITIATE message by calling the SendMessage function, specifying HWND_BROADCAST. The SendMessage call will not return until each top level window has processed the WM_DDE_INITIATE message. The hang that occurs when calling DDEInitiate is the result of one or more threads that own a top level not having an active message pump.

The ListBlockedWindow tool helps to identify each process that contains  threads that do not have an active message pump and own one or more top level windows. The applications identified by the ListBlockedWindow tool should be updated such that each thread that owns a window has an active message pump, even when a given thread owns windows that are not visible. The term “message pump” (or message loop) refers to the calls a thread makes to the GetMessage or PeekMessage functions to retrieve/process any pending window messages for windows owned by the thread. A thread that owns a window receiving a WM_DDE_INITIATE message and does not actively call GetMessage or PeekMessage will cause the thread that is sending the WM_DDE_INITIATE message with SendMessage to block until the message is processed.

Please refer to the following links for additional information about DDE and message processing in Windows.

About Dynamic Data Exchange –

Using Messages and Message Queues –

SendMessage function –

Note: this content is not mine, borrowed from my colleague-DaveAnd


October 25, 2014 - Posted by | .NET General, Office

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: