The Date/Time Control Panel

This post will be the last post on this blog. I have decided to move to a new blog. Follow me here for all my latest content.

Going back to the content…

Although you can use the Date/Time control panel to flip through a calendar, it originally wasn’t supposed to be a calendar. In fact, if you used it that way, you could have caused lots of havoc!

Windows 95 Date/Time Control Panel

In its original incarnation in Windows 95, the Date/Time control panel changed your date and time. If you clicked through the calendar to see the next month, you actually changed your system clock to the next month. If you changed your mind and clicked “Cancel”, the Date/Time control panel undid its changes and restored the date to the original date.

In other words, here’s what happened step-by-step:

  • On April 1, you open the Date/Time control panel.
  • You change the date to May. The Date/Time control panel changes your system date to May 1. If you are running a appointment program, all appointments from April will fire. (For example, your April 15th alarm to file your taxes.) You are annoyed by all these alerts and you cancel them.
  • You decide you didn’t want to change to the month of April after all and click Cancel.
  • The Date/Time control panel changes back to April.
  • On April 15, your income tax alarm fails to fire because you canceled it, remember?

In other words, the Date/Time control panel was not designed to let you flip Windows XP Date/Time Control Panelthrough a calendar. It was designed for changing the system date/time.

Unaware of this, people have been using the Date/Time control panel as if it were a calendar, not realizing it was doing all sorts of crazy things behind the scenes. It’s like using a cash register as an adding machine. Sure, it does a great job of adding numbers together, but you’re messing up the accounting at the main office!

For Windows 2000, in reluctant recognition of how people have been misusing the Date/Time control panel (alternatively, “Unaware of it’s users habits…”), it was rewritten so that it doesn’t change the system time until you click the apply button.

Aaron Margosis shows you how to grant a user permission to change the system date and time in Windows XP without having to make them a full administrator.

Advertisements

The System “Tray”

Why do some people call the taskbar the “tray”?

Short answer: Because they’re wrong.

Long answer:

The official name for the thing at the bottom of the screen is the “taskbar”. The taskbar contains a variety of elements, such as the “Start Button”, a collection of “taskbar buttons”, the clock, and the “Taskbar Notification Area”.

The Windows 7 Taskbar

One of the most common errors is to refer to the Taskbar Notification Area as the “tray” or the “system tray”. This has never been correct. If you find any documentation that refers to it as the “tray” then you found a bug.

In early builds of Windows 95, the taskbar originally wasn’t a taskbar; it was a folder window docked at the bottom of the screen that you could drag/drop things into/out of, sort of like the organizer tray in the top drawer of you desk. That’s where the name “tray” came from. (Some might argue that this was taking the desktop metaphor a bit too far.)

Artist’s conception (i.e., I sat down with Paint and tried to reconstruct it from memory) of what the tray looked like at this time:

The "System Tray"

The tray could be docked to any edge of the screen or it could be undocked and treated like any other window.

Then we ditched the tray and replaced it with the taskbar. We removed all occurrences of “tray” and changed it to “taskbar”. If you go through the shell documentation, you should not find the word “tray” anywhere.

A little while later, we added notification icons to the taskbar.

I think the reason people started calling it the “system tray” is that on Win95 there was a program called “systray.exe” that displayed some icons in the notification area: volume control, PCMCIA (as it was then called) status, battery meter. If you killed systray.exe, you lost those notification icons. So people thought, “Ah, systray must be the component that manages those icons, and I bet its name is ‘system tray’.” Thus began the misconception that we have been trying to eradicate for over eighteen years…

Even worse, other groups (not the shell) picked up on this misnomer and started referring it to the tray in their own documentation and samples, some of which even erroneously claim that “system tray” is the official name of the notification area.

“But why do you care? That’s what everybody calls it now, may as well go with the flow.”

How would you like it if everybody started calling you by the wrong name?

Summary: It is never correct to refer to the notification area as the tray. It has always been called the “notification area”.

Undoing Minimize All & Show Desktop

It seems that it’s not very well-known on how to undo a Minimize All or Show Desktop, two operations I briefly discussed yesterday.

Screenshot with "Minimize All" Undone

To undo a Minimize All, you can right-click the taskbar and select “Undo Minimize All”, or at least you used to be able to do that. Minimize All is no longer on the menus, presumably because it ended up being redundant with Show Desktop.

So after you do your ÿ+M to Minimize All, you can use ÿ+Shift+M to undo Minimize All.

To undo a Show Desktop, just click Show Desktop again. If you used the keyboard accelerator ÿ+D, just press it a second time.

Desktop Screenshot with "Show Desktop" Undone

Minimize All & Show Desktop

The keyboard shortcut for “Minimize All” is ÿ+M and The keyboard shortcut for “Show Desktop” is ÿ+D. How are they different?

Minimize All In Action

“Minimize All” is easier to describe. It minimizes all the windows that support the “Minimize” command. You can minimize a window by selecting “Minimize” from its System menu, or by clicking the 0 button in the title bar. So “Minimize All” is effectively the same as going to each window that is open and clicking the Minimize button. If there is a window that doesn’t have a Minimize button, then it is left alone.

“Show Desktop” takes “Minimize All” one step further. After minimizing all the windows that can be minimized, it then takes the desktop and “raises” it to the top of the window stack so that no other windows cover it. (Well, okay, topmost windows continue to cover it.)

Screenshot of the Windows 8 Desktop

So “Show Desktop” manages to get a few more windows out of your way than “Minimize All”.

Note, however, that when you return the desktop to its normal state (either by selecting “Show Open Windows” or just by switching to another window), all the un-minimizeable windows come back because the desktop has “lowered” itself back to the bottom of the window stack.

Moreover, there is no hidden meaning in the flowers background in the last image and I don’t know what it “signifies.”

The Look of Luna

Luna was the code name for the Windows XP “look”. The designers did a lot of research (and got off to a lot of false starts, as you might expect) before they came to the design they ultimately settled upon.

Windows XP "Luna" Visual Style

During the Luna studies, that people’s reaction to Luna was often, “Wow this would be a great UI for X,” where X was “my dad” or “my employees” or “my daughter”. People didn’t look at it as the UI for themselves; rather, they thought it was a great UI for somebody else.

It was sometimes quite amusing to read the feedback. One person would write, “I can see how this UI would work great in a business environment, but it wouldn’t work on a home computer.” and the very next person would write “I can see how this UI would work great on a home computer, but it wouldn’t work in a business environment.”

(And interestingly, even though armchair usability experts claim that the “dumbed-down UI” is a hindrance, our studies showed that people were actually more productive with the so-called “dumb” UI. Armchair usability experts also claim that the Luna look is “too silly for serious business purposes”, but in reality it tested very well on the “looks professional” scale.)

Windows Vista "Aero" Visual Style

Aero was the code name for the Longhorn and Windows Vista “look”. With Aero, the designers have turned an important corner. Now, when they show Aero to people, the reaction is, “Wow, this would be a great UI for me to use.

People want Luna for others, but they want Aero for themselves.

People, it seems, are terrible at judging themselves.

Cleaning Up After Dead Processes

Why do some processes stay in Task Manager after they’ve been killed?

When a process ends (either of natural causes or due to something harsher like TerminateProcess), the user-mode part of the process is thrown away. But the kernel-mode part can’t go away until all drivers are finished with the thread, too.

Windows Task Manager Process Tab

For example, if a thread was in the middle of an I/O operation, the kernel signals to the driver responsible for the I/O that the operation should be cancelled.  If the driver is well-behaved, it cleans up the bookkeeping for the incomplete I/O and releases the thread.

If the driver is not as well-behaved (or if the hardware that the driver is managing is acting up), it may take a long time for it to clean up the incomplete I/O.  During that time, the driver holds that thread (and therefore the process that the thread belongs to) hostage.

(This is a simplification of what actually goes on. Commenter Skywing gave a more precise explanation, for those who like more precise explanations.)

If you think your problem is a wedged driver, you can drop into the kernel debugger, find the process that is stuck and look at its threads to see why they aren’t exiting.  You can use the !irp debugger command to view any pending IRPs to see what device is not completing.

After all the drivers have acknowledged the death of the process, the “meat” of the process finally goes away. All that remains is the “process object”, which lingers until all handles to the process and all the threads in the process have been closed. (You did remember to CloseHandle the handles returned in the PROCESS_INFORMATION structure that you passed to the CreateProcess function, didn’t you?)

In other words, if a process hangs around after you’ve terminated it, it’s really dead, but its remnants will remain in the system until all drivers have cleaned up their process bookkeeping, and all open handles to the process have been closed.

Trapping TerminateProcess

If a user fires up Task Manager and clicks “End Task” on your program, Windows first tries to shut down your program nicely, by sending WM_CLOSE messages to GUI programs and CTRL_CLOSE_EVENT events to console programs. But you don’t get a chance to intercept TerminateProcess?

TerminateProcess is the low-level process killing function. It bypasses DLL_PROCESS_DETACH and anything else in the process. Once you with TerminateProcess, no more user-mode code will run in that process. It’s gone. Do not pass go. Do not collect $200.

Task Manager Process Tab

If you could intercept TerminateProcess, then you would be escalating the arms race between programs and users. Suppose you could intercept it. Well, then if you wanted to make your program unkillable, you would just hang in your TerminateProcess handler.

And then people would be asking for “a way to kill a process that is refusing to be killed by TerminateProcess” and we’d be back where we started.

Tomorrow: About those processes that don’t go away even though you’ve killed them. They’re really dead, but they won’t go away.