Holy cow, I wrote a book!
An extension of the "What if two programs did this?" thought experiment
is the "Who says there's only one?" question.
A common question I see is, "From a service, how do I
do X with the currently logged-on user?"
(Where "X" can be a variety of things
such as interact with them or impersonate them.)
But who says that there's only one?
With the introduction of Fast User Switching in Windows XP,
the possibility for multiple logged-on users exists even in
You might say, "Well, I mean that among all the users that are
logged on, I want the one that's using the computer right now."
Except that with
Media Center Extender,
there can still be two users,
one sitting at the console and another in the TV room with the extender,
and both of them are using the computer right now.
And on the server side of things,
has been around since NT4
(a limited version of which is available in
Windows XP Professional under the name "Remote Desktop").
There are many variations on this question.
"How can I check whether the 'Press Ctrl+Alt+Del to begin' dialog
is being displayed?"
There is not just one such dialog;
there is one for every session.
If there are three users logged onto the machine,
one of them logged in and active,
another one disconnected,
and a third sitting at the 'Press Ctrl+Alt+Del to begin' dialog,
what should the answer be?
That depends on what you're planning to use this information for.
Sometimes it takes a few iterations before people get the message,
and sometimes they never do.
"How do I impersonate the currently logged-on user?"
"Which user? There can be more than one. <explanation>"
"I want the one on the desktop."
"They all have their own desktop."
"I want the one on the current desktop."
"What do you mean by 'the' current desktop?
There is one current desktop for each user."
"I want the desktop I should display my UI on."
"Your question has become circular.
You want to display your UI on the desktop
that your UI should be displayed on."
"Why won't you answer my question?!"