Showing archive results for 2013

Jun 12, 2013
Post comments count0
Post likes count1

Dispatch interfaces as connection point interfaces

Raymond Chen

Last time, we learned about how connection points work. One special case of this is where the connection interface is a dispatch interface. Dispatch interfaces are, as the name suggests, COM interfaces based on IDispatch. The IDispatch interface is the base interface for OLE automation objects, and if you want your connection point interface to...

Code
Jun 11, 2013
Post comments count0
Post likes count1

An introduction to COM connection points

Raymond Chen

Last time, we saw how to enumerate all the Internet Explorer and Explorer Windows and see what they are viewing. But that program printed static information. It didn't track the changes to the windows if the user clicked to another Web page or navigated to a different folder. In order to hook that up, we need to understand the connection point ...

Code
Jun 10, 2013
Post comments count0
Post likes count0

Unexpected complexity of Swedish pronouns, and escaping the resulting embarrassment

Raymond Chen

I dreamed that Swedish had separate third-person-plural pronouns based on gender. They were formed from han and hon by adding a common suffix, but the pattern broke down for det, and I got stuck trying to finish a sentence without knowing the correct word. I was able to escape from this embarrassing situation by using a technique available only i...

Non-ComputerDream
Jun 10, 2013
Post comments count0
Post likes count1

A big little program: Monitoring Internet Explorer and Explorer windows, part 1: Enumeration

Raymond Chen

Normally, Monday is the day for Little Programs, but this time I'm going to spend a few days on a single Little Program. Now, this might very well disqualify it from the name Little Program, but the concepts are still little; all I'm doing is snapping blocks together. (Plus, it's my Web site, so you can just suck it.) The goal of our Little Pro...

Code
Jun 7, 2013
Post comments count0
Post likes count2

Sharing an input queue takes what used to be asynchronous and makes it synchronous, like focus changes

Raymond Chen

As I noted earlier in the series, attaching input queues puts you back into the world of coöperative multitasking, where the two attached threads need to work together to get anything done. Back in the old 16-bit days, when input was synchronous, there was only one active window, only one focus window, only one window with capture, only one...

Code
Jun 6, 2013
Post comments count0
Post likes count1

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

Raymond Chen

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 Window...

Code
Jun 5, 2013
Post comments count0
Post likes count1

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

Raymond Chen

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 looking at ...

Code
Jun 4, 2013
Post comments count0
Post likes count1

Asynchronous input vs synchronous input, a quick introduction

Raymond Chen

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 proce...

Code
Jun 3, 2013
Post comments count0
Post likes count1

When a CD gets stuck on infinite repeat during the night

Raymond Chen

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. Moral of ...

Non-ComputerDream
Jun 3, 2013
Post comments count0
Post likes count1

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

Raymond Chen

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, WDA...

Code