title: SendMessage() WINAPI gets hang when used to connect to a DDE server
body: <p>I have a DDE client app which connects to the DDE server app by using <code>SendMessage()</code> WINAPI. Following the <code>SendMessage()</code> call which gets hang while requesting connection to the DDE Server. Both DDE Client app and server app are in VC++.</p>
  
  <pre><code>SendMessage((HWND) -1,WM_DDE_INITIATE,(WPARAM) m_hWnd,MAKELPARAM(hService,hTopic));
  </code></pre>
  
  <p>Now what <code>SendMessage()</code> is doing that it is getting hanged?  Basically it is broadcasting <code>WM_DDE_INITIATE</code> window message to all the windows in the system. The window (DDE server) for which it is intended should process the message and should reply with an acknowledgment. Once acknowledgment is received <code>SendMessage()</code> call is completed and client is connected.</p>
  
  <p>In our case it is getting hang and is never returning back, as a result we have DDE Client application getting hang. </p>
  
  <p>I searched on the net and found that using <code>SendMessage()</code> to broadcast is usually not recommended as it gets hang many times.</p>
  
  <p>I have code for the DDE client app and DDE server app with me. </p>
  
  <p>Let me know is there some way to retrieve the DDE server window handle or some way to assign a unique name to the DDE server window .</p>
  
  <p>By doing this, i believe at the client end i can retrieve the window handle of DDE server from unique name (using <code>FindWindow()</code> winapi) and instead of broadcasting using <code>SendMessage()</code> I can send the message directly to DDE server using window handle.</p>
  
  <p>If you feel above method of getting window handle of DDE server is not possible or not recommended, then do let me know some other method to use <code>SendMessage()</code> winapi to connect to DDE Server.</p>