The Old New Thing

A subtlety in restoring previous window position

A common feature for many applications is to record their screen location when they shut down and reopen at that location when relaunched. If implemented naively, a program merely restores from its previous position unconditionally. You run into usability problems with this naive implementation. If a user runs two copies of your program, the ...

VegFest 2005 this weekend – and – vegetarian is as vegetarian does

The weekend of March 12th and 13th, Vegetarians of Washington is hosting VegFest 2005, a festival of vegetarian food. This reminds me of a Time Magazine cover story from July 2002, wherein it was revealed that... In a survey of 11,000 individuals, 37% of those who responded "Yes, I am a vegetarian" also reported that in the previous 24 ...

Performance gains at the cost of other components

In the operating systems group, we have to take a holistic view of performance. The goal is to get the entire system running faster, balancing applications against each other for the greater good. Applications, on the other hand, tend to have a selfish view of performance: "I will do everything possible to make myself run faster. The impact ...

Why does SystemParametersInfo hang when I pass the SPIF_SENDCHANGE flag?

If you pass the SPIF_SENDCHANGE flag to the SystemParametersInfo function, it will broadcast the WM_SETTINGCHANGE message with the wParam equal to the system parameter code you passed. For example, if you call then the system will broadcast the message If there is a window that isn't responding to messages, then this broadcast will ...
Comments are closed.0 0
Code

Using SystemParametersInfo to access user interface settings

The SystemParametersInfo function gives you access to a whole slew of user interface settings, and it is the only supported method for changing those settings. I'm not going to list every single setting; go read the list yourself. Here are some highlights: Here are some control panel settings. Notice that when using the SPI_SET* ...
Comments are closed.0 0
Code

Keep your eye on the code page

Remember that there are typically two 8-bit code pages active, the so-called "ANSI" code page and the so-called "OEM" code page. GUI programs usually use the ANSI code page for 8-bit files (though utf-8 is becoming more popular lately), whereas console programs usually use the OEM code page. This means, for example, when you open an 8-bit ...

A timed context menu

This is sort of in the same spirit as our previous exercise in writing a timed message box, but this is much easier. Here, we use the handy-dandy WM_CANCELMODE message to get us out of menu mode. Before displaying the menu, we set a timer. (And we use a thread timer because we don't own the hwnd window and therefore don't know what timer...
Comments are closed.0 0
Code

Modality, part 8: A timed MessageBox, the better version

A few days ago, we saw a simple version of a timed message box which had a limitation that it could be used from only one thread at a time. Today we'll work to remove that limitation. As you may recall, the reason why it could be used from only one thread at a time was that we kept the "Did the message box time out?" flag in a global. To ...

Raymond's random walk, from Swedish designers to Mr. Monkey

My random walk began at Svenska Dagbladet and the article Svensk designer upprör skottar, about Swedish designer Johanna Larson whose T-shirt depicting the traffic-cone-wearing Duke of Wellington has sparked a debate in the city. The article mentions that the tradition of placing a traffic cone on the head of the Duke is twenty years ...

The bonus window bytes at GWLP_USERDATA

The window manager provides a pointer-sized chunk of storage you can access via the GWLP_USERDATA constant. You pass it to the GetWindowLongPtr function and the SetWindowLongPtr function to read and write that value. Most of the time, all you need to attach to a window is a single pointer value anyway, so the free memory in GWLP_USERDATA is...
Comments are closed.0 0
Code