Consider the following scenario:
- An application uses the SendMessage function to broadcast a WM_DDE_INITIATE message to initiate a Dynamic Data Exchange (DDE) conversation with another application.
- Microsoft Lync, Microsoft Skype for Business, or Microsoft Outlook is running.
In this scenario, the application hangs. Additionally, the application resumes when Lync, Skype for Business, or Outlook is closed.
Broadcasting a WM_DDE_INITIATE message is the first step for an application to establish a DDE conversation with a DDE server. The WM_DDE_INITIATE message is used to determine whether a window supports the application or topic that’s specified in the LPARAM parameters of the message.
Some applications use the SendMessage function to broadcast WM_DDE_INITIATE messages. The SendMessage function doesn't return until all top-level windows have processed the WM_DDE_INITIATE message. Any thread that owns a top-level window causes SendMessage to block the calling thread indefinitely when the thread doesn't actively process window messages.
Lync, Skype for Business, and Outlook may create hidden top-level windows on threads that don't actively process window messages.
To avoid this problem, the application should use the SendMessageTimeout function to broadcast window messages. Using the SendMessageTimeout function will avoid blocking the calling thread indefinitely when the threads that own top-level windows don’t actively process window messages.