The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts

Don’t you hate it when someone leaks a ref to your clothes?

The other night I had a dream in which one of my friends said, "Check out my clothes closet. This dress is hideous, but I can't get rid of it because there's still a reference to it from my blog." The dresses were labeled through .

The dangers of mixing synchronous and asynchronous state

The window manager distinguishes between synchronous state (the state of the world based on what messages your program has received) and asynchronous state (the actual state of the world this very instant). We saw this earlier when discussing the difference between GetKeyState and GetAsyncKeyState. Here are some other functions and their relationship to the queue state: Use synchronous state Use asynchronous state GetActiveWindow GetForegroundWindow GetMessagePos GetCursorPos GetMessageTime GetTickCount If you query the asynchronous state while processing a message, you can find yourself cau...

Welcome to Leavenworth, Washington’s faux-Bavarian village

The dying logging town of Leavenworth, Washington reinvented itself in the 1960's as a faux-Bavarian village. Today, over a million tourists visit annually to enjoy the scenic mountain views, soak in the fake Bavarian atmosphere, and revel in events like the Leavenworth International Accordion Celebration which starts tomorrow, or the three-weekend-long Leavenworth Oktoberfest every October. (Mind you, the Leavenworth Oktoberfest doesn't actually start until the Munich Oktoberfest is nearly over, because Oktoberfest starts in September.) I found during a brief visit to Leavenworth that the people there may d...

Sure, I can get spurious WM_MOUSEMOVE messages, but why do they keep streaming in?

I wrote some time ago that the window manager generates spurious messages in order to let programs know that the mouse has entered the window even if the reason was a window hierarchy reshuffle rather than a physical motion of the pointing device. But some people have noticed that that explanation fails to account for all the messages that are being delivered. In particular, the reasoning fails to explain why a stream of messages is being generated. So where is this infinite stream of messages coming from, even when the window hierarchy is stable? They're most likely coming from some third party so-called...

Management-speak: Upping the sats and stimulating the ecosystem

Here's another sentence that's so loaded with buzzwords and buzzphrases I'm not sure what language it's written in. I just want to have creative control over how my audience can interact with me without resorting to complex hacking in a way that is easy to explain but ups our blogging audiences sats to a new level that may also stimulate a developer ecosytem that breeds quality innovation... The ellipses are in the original, if that helps any. The scary thing is: The person who wrote this isn't even a manager.

Happening to be at the same post-concert restaurant as symphony performers

Getting out of the parking garage immediately after the symphony ends is usually a bit of an ordeal, so my symphony group tends to linger downtown for some coffee or dessert, allowing time for the post-symphony traffic jams to clear out. The other night, we went to the Union restaurant just a block from Benaroya Hall. (Verdict: Not a good dessert restaurant.) After we placed our orders, violinists Elisa Barston (my current "favorite symphony performer") and Mikhail Shmidt came in and were seated at the table next to us. I tried not to stare, but even though I've sat quite close to Elisa Barston before, this ti...

Why do some file operations take file names and others take handles?

Commenter Brian Friesen asks why some functions (like SetFileAttributes) take a file name, while others (like SetFileTime) take a handle and why we can't have two versions of every API, one for each pattern. Second question first: No need to wait for the kernel folks to write such a function; you can already do it yourself! // Following "pidgin Hungarian" naming convention, which appears // to be dominant in <winbase.h>... BOOL SetFileTimesByNameW(LPCWSTR lpFileName, CONST FILETIME *lpCreationTime, CONST FILETIME *lpLastAccessTime, ...

Fortune cookie fortunes are getting less and less interesting all the time

I remember reading a story about the history of fortune cookie fortunes, and how the pool of fortunes has been getting smaller because people keep complaining about them. In the article, they gave as an example that the fortune "You will meet a stranger" was removed from the fortune library because somebody complained that it was too scary. The effects of this trend toward meaningless fortunes continue to be felt. A few years ago, I opened a fortune cookie and looked at the slip of paper inside. It read simply Someone will give you something.

A concrete illustration of practical running time vs big-O notation

Memory access time changes the math.