Showing tag results for Code

Mar 22, 2007
Post comments count0
Post likes count1

Excursions in composition: Sequential stream concatenation

Raymond Chen

As we've seen a few times already (when building context menus and exploring fiber-based enumeration), composition is an important concept in object-oriented programming. Today, we're going to compose two sequential streams by concatenation. There really isn't much to it. The idea is to take two streams and start by reading from the first one....

Code
Mar 19, 2007
Post comments count0
Post likes count1

How do the menu functions find items?

Raymond Chen

Most of the menu item functions such as allow you specify the menu item either by position or by command. Some of them use the and flags. Others separate the search algorithm into a separate flag. Searching for menu items by position is straightforward: The specified position is used as a zero-based index into the menu. In other words, the fir...

Code
Mar 16, 2007
Post comments count0
Post likes count1

The format of accelerator table resources

Raymond Chen

Continuing in the extremely sporadic series on the format of resources, today we'll take a look at accelerator tables. This topic is so simple, I'll cover both 16-bit and 32-bit resources on the same day! In 16-bit Windows, the format of an accelerator table resource was simply an array of structures. This array is the same array you would ...

Code
Mar 13, 2007
Post comments count0
Post likes count1

The only thing you can do with display names is display them

Raymond Chen

There are many functions that return strings called "display names". And the only thing you can do with display names is display them. Don't assume that the string actually means anything, because it doesn't. Theoretically, a function like could be implemented as and your program should still work. (Of course, this is merely a ground rule. S...

Code
Mar 8, 2007
Post comments count0
Post likes count1

The GETDISPINFO notifications tell you what information they want

Raymond Chen

The notifications used by the common controls are used when the control asks its parent to generate information that had been marked as delay-rendered, either explicitly via values such as or implicitly by being an owner-data control, for example. In fact the control is really just the middle man between the code that requested information about...

Code
Feb 26, 2007
Post comments count0
Post likes count1

Please feel free to stop using DDE

Raymond Chen

A commenter asked, "As an application programmer, can I really ignore DDE if I need to interact with explorer/shell?" The answer is, "Yes, please!" While it was a reasonable solution back in the cooperatively-multitasked world of 16-bit Windows where it was invented, the transition to 32-bit Windows was not a nice one for DDE. Specifically, the ...

Code
Feb 22, 2007
Post comments count0
Post likes count1

With what operations is LockWindowUpdate not meant to be used?

Raymond Chen

Okay, now that we know what operations is meant to be used with, we can look at various ways people misuse the function for things unrelated to dragging. People see the "the window you lock won't be able to redraw itself" behavior of and use it as a sort of lazy version of the message. Though sending the message really isn't that much harder ...

Code
Feb 21, 2007
Post comments count0
Post likes count1

With what operations is LockWindowUpdate meant to be used?

Raymond Chen

As I noted earlier, the intended purpose of can be captured in one word: dragging. The simplest case of is used by the window manager when you move or resize a window and "Show window contents while dragging" is disabled. When you start the move/size operation, the window manager locks the entire desktop so it can draw the dotted-rectangle feed...

Code
Feb 20, 2007
Post comments count0
Post likes count1

How is LockWindowUpdate meant to be used?

Raymond Chen

Now that we know how works, we can look at what it is for. Actually, the intended purpose of can be captured in one word: dragging. But we'll get to that a little later. The purpose of is to allow a program to temporarily take over the responsibility of drawing a window. Of course, in order to do this, you have to prevent the window procedure...

Code