When a client wishes to terminate the conversation, it posts a WM_DDE_TERMINATE message to the server. The server simply responds with its own WM_DDE_TERMINATE message back to the client. ServerProc also destroys the child window on receipt of WM_DDE_TERMINATE because it is no longer needed, and the conversation that the window has maintained is terminated.
ServerProc also processes WM_DDE_POKE and WM_DDE_EXECUTE messages, but in both cases simply responds with a negative acknowledgment.
If DDEPOP is closed from its system menu, then it must terminate all DDE conversations with its clients. So, when WndProc receives a WM_CLOSE message, it calls EnumChildWindows with the CloseEnumProc function. CloseEnumProc sends WM- CLOSE messages to all the child windows.
ServerProc responds to WM_CLOSE by posting a WM_DDE_TERMINATE message to the client and then waiting for another WM_DDE_TERMINATE message back from the client.