The Old New Thing

A pathological program which ignores the keyboard, and understanding the resulting behavior based on what we know about the synchronous input

Today, we'll illustrate the consequences of the way the window manager synchronizes input when two or more threads decide to share an input queue. Since I need to keep separate state for the two windows, I'm going to start with the new scratch program and make the following changes: #include <strsafe.h> class RootWindow : public ...
Comments are closed.0 0
Code

When you share an input queue, you have to wait your turn

Now that we've had a quick introduction to asynchronous input, let's look at some of the details. Remember, this is a peek under the hood at how the sausage is made. The algorithm described here is not part of the API contract and it can change at any time, as long as it services the overall goal of serializing input. Let's start by ...
Comments are closed.0 0
Code

Asynchronous input vs synchronous input, a quick introduction

One of the topics I covered at my PDC talk was the asynchronous input model. I don't think I ever discussed it on this Web site, so I guess I'll do it now, so that I can point people at it in the future. In the old days of 16-bit Windows, input was synchronous. All input went into a system-wide input queue, and the intuitive rule for input ...
Comments are closed.0 0
Code

When a CD gets stuck on infinite repeat during the night

One night, the CD player got stuck due to a scratched disc and ended up repeating the same track over and over again. I dreamed that the song was O(n²) in length,¹ with each new verse one bar longer than the previous one, but unlike a cumulative song,² the location of the inserted bar varied randomly from verse to verse. ...

How do I make it more difficult for somebody to take a screenshot of my window?

Ultimately, you can't stop somebody from ignoring the words Confidential at the top of a document and whipping out a digital camera and taking a picture of the screen. But at least starting in Windows 7 you can make it a little more difficult. Take our scratch program and add this one line: ... SetWindowDisplayAffinity(hwnd...
Comments are closed.0 0
Code