The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
Swamping the thread pool with work faster than it can drain
This scenarios is real, but details have been changed to protect the guilty. Consider a window showing the top of a multi-page document. The developers found that when the user clicks the down-arrow button on the scroll bar, the program locks up for 45 seconds, over a dozen threads are created, and then suddenly everything clears up and the window displays the final paragraph of the document (i.e., it scrolled all the way to the bottom). The problem was traced to queueing tasks to the thread pool faster than they can drain. The document is an object which, unlike a window, has no thread affinity. (Naturall...
How do I control X-Mouse settings (active window tracking)?
For quite some time, Windows has had a setting officially called active window tracking but which informally goes by the name X-Mouse, because that was the name of the PowerToy which first exposed the feature. (The PowerToy was in turn so-named because it made the mouse behave in a manner similar to many X window managers.) The setting is exposed to end users in Windows 7 on Make the mouse easier to use under Activate a window by hovering over it with the mouse. If you want to write your own PowerToy to control this setting, you can do so by calling the function. There are three settings which collective...
How do I prevent users from pinning my program to the taskbar?
A customer wanted to prevent users from pinning their application to the taskbar. I have an application that is launched as a helper by a main application. Users shouldn't be launching it directly, but rather should be launching the main application. But since the helper shows up in the taskbar, users may be tempted to right-click on the taskbar icon and select "Pin to taskbar." Unfortunately, this pins the helper program to the taskbar instead of the main application, and launching the helper program directly doesn't work. Is there a way I can prevent users from pinning the helper program? It so happens tha...
My evil essence revealed
I found it amusing that somebody considered the fact that Microsoft employees can read my queued-up blog entries before the articles are published to be further evidence of Microsoft's evil essence as a monopoly. Just for the record, this is not evidence of Microsoft's evil essence as a monopoly. Rather, it's evidence of Raymond's evil essence as a monopoly, because the monopoly on blog articles written by Raymond Chen that haven't yet been published belongs to me.
Just for fun: Sample user names in Windows 7
Names from around the world.
Why are custom properties created on Windows 2000 lost when I view the file from newer versions of Windows?
In Windows 2000, Explorer let you add properties like Summary and Author to nearly any file type. But when you view the files from a machine running Windows XP or later, those properties are lost. Where did they go? Most file types do not have extensibility points for adding metadata. For example, every byte of a plain text files is devoted to text data; there is nowhere to put metadata like Author or Summary. In Windows 2000, the shell chose to store this extra information in NTFS alternate data streams (or more accurately, the shell chose to use the storage format, which is implemented in term...
How do IsThemeActive, IsAppThemed, and IsCompositionActive differ?
There are three functions which test very similar things, and sometimes applications pick the wrong one. Here's the rundown: Note that these functions do not answer the question "Is the application using the visual-styles-enabled version of the common controls library?" That question is harder to answer because the decision to use the visual-styles-enabled version of the common controls library is not a process-wide one but is rather made on a window-by-window basis. You can have an application where half of the button controls are the old non-visual-styles version and half of the button controls participate i...
WinMain is just the conventional name for the Win32 process entry point
is the conventional name for the user-provided entry point in a Win32 program. Just like in 16-bit Windows, where the complicated entry point requirements were converted by language-provided startup code into a call to the the user's function, the language startup code for 32-bit programs also does the work of converting the raw entry point into something that calls (or or ). The raw entry point for 32-bit Windows applications has a much simpler interface than the crazy 16-bit entry point: The operating system calls the function with no parameters, and the return value (if the function ever returns) i...
Microspeak: PowerPoint Karaoke and the eye chart
The game PowerPoint-Karaoke was invented in 2006 by Zentrale Ingelligenz Agentur. In this game, contestants are called upon to give a PowerPoint presentation based on a slide deck they have never seen. (The German spelling uses a hyphen between the two words. When "translated" into English, the hyphen is often omitted.) At Microsoft, the term has been extended to refer to giving a presentation from slides prepared by somebody else, usually on short notice and therefore with little preparation. Bob is out sick today, so I'll be giving the overview. Sorry for the PowerPoint Karaoke. This is shorthand for "Sorr...