Although you are more than welcome to stop using DDE (please oh please stop using it), there are still many applications which still use it (cough), and as a result, customers still have questions about it.
One customer wanted to know why, if multiple copies of a DDE-based application are running, Windows 7 will send the command to the earliest-launched copy of the program, whereas Windows XP will send the command to the most-recently-used copy. "Our employees were used to forcing the document to open in a specific window by switching to that window, thereby making it most-recently-used, then switching back to Explorer and double-clicking the document, and expecting it to open in that window. And that usually (but not always) worked. In Windows 7, it rarely works. Is there an explanation for this change in behavior other than 'internal process and window handling stuff'?"
It's internal process and window handling stuff.
If multiple DDE servers are available to handle a command, it is unspecified what order they are used.
It so happens that Windows XP uses
SendMessageTimeout with the
HWND_ window target, and it so happens that
SendMessageTimeout on Windows XP sends the messages in top-to-bottom order by z-order. If all windows are responding to messages, then it means that the window closest to the top of the z-order will get the first chance to respond. If there are unresponsive windows, then things get more complicated, and as the customer noted, the results become somewhat unpredictable. (Also, if there are unresponsive windows, your machine froze for 30 seconds.)
In Windows Vista an optimization was added: Instead of just diving in and broadcasting DDE requests to everybody in search of a server, Explorer remembers the last window that responded and goes straight to that window first, on the theory that if it knew how to handle the Open command last time, it most likely will know how to handle it this time. And it can do this even if other applications are not responding to messages.
If the optimization fails, then Explorer goes back to the slow broadcast method. But most of the time, the optimization works, and the document gets launched much faster.