The WM_DDE_TERMINATE Message

Handling a WM_DDE_TERMINATE message posted by the server is simple: SHOWPOP simply posts another WM_DDE_TERMINATE message back to the client and sets the hwndServer variable to NULL (indicating the conversation is over).

If SHOWPOP is closed (indicated by a WM_CLOSE message), then the program first posts a WM_DDE_UNADVISE message to the server to prevent any future updates. This uses a NULL item atom to indicate all data items. SHOWPOP then posts a WM_DDE_TERMINATE message to the server and waits for a WM_DDE_TERMINATE message to return back from the server.