The Old New Thing

How do I find out what size the window manager would have chosen for my window?

We saw some time ago how the window manager decides where to place a newly-created window if you pass the CW_USE­DEFAULT values when creating the window. But what if you want to filter the values first? If you pass an explicit upper left corner but pass CW_USE­DEFAULT for the width and height, then the bottom right corner will be down...
Comments are closed.0 0
Code

Using the TAB key to navigate in non-dialogs, redux

You want to use the TAB key to navigate through a non-dialog,so youcall Is­Dialog­Message in your message loop,but it doesn't work!The problem here is that you are passing the wrongwindow handle toIs­Dialog­Message.The first parameter toIs­Dialog­Messageis the dialog-like window you want to be able to ...
Comments are closed.0 0
Code

I wrote my thesis on an airplane, for heaven's sake

As I wrote today's story, I recalled that I wrote the bulk of my thesis on an airplane. In longhand. Microsoft flew me out for an interview, so I had to endure two cross-country plane trips. I scheduled the interview on a Monday so that I would miss only one day of class, and among the things I brought with me was a notepad, which started ...

I wrote FAT on an airplane, for heaven’s sake

When you wrote code for 16-bit Windows, one of the things you spent time doing as part of performance tuning was deciding which functions should be grouped together in which segments.Code in 16-bit Windows executed out of code segments, each of which could be up to 64KB in size. When a code segment was loaded from disk, the entire segment ...

But instead, they decided to build the Great Wheel

I dreamed that Seattle was building its own version of the Eiffel Tower. Just like the original, except that it was also a thrill ride similar to Round Up but you are seated. It turns out that the city of Seattle accepted my subconscious's instructions to replicate another city's famous landmark, but the message wasn't received loud and ...

Printing the contents of the clipboard as text to stdout

The clip.exe takes its stdin and puts it on the clipboard.But how do you get it out?That's today's Little Program.(I guess we could call itclop.exe.)Okay, what do we have here?We open the clipboard and try to get the Unicode text on it.We then look for the null terminator within the first0x10000000 bytes.Why do I stop at 256MB?...
Comments are closed.0 0
Code

What's the difference between CopyIcon and DuplicateIcon?

There are two functions that can be used to create one icon that is identical to another. One of them is Copy­Icon. The other is Duplicate­Icon. What's the difference? There isn't any difference. Both functions clone an icon. In fact, their implementations are basically line-for-line identical. Originally, there was just one function...
Comments are closed.0 0
Code

The relationship between module resources and resource-derived objects in 32-bit Windows

Last time, we saw how 16-bit Windows converted resources attached to an EXE or DLL file (which I called module resources for lack of a better term) to user interface resources. As a refresher: During the conversion from 16-bit Windows to 32-bit Windows, some of these rules changed. Specifically, icons, cursors, and accelerator tables are no...
Comments are closed.0 0
Code

The relationship between module resources and resource-derived objects in 16-bit Windows

As we saw last time, in 16-bit Windows, resources attached to an EXE or DLL file (which I called module resources for lack of a better term) were recorded in memory as discardable global memory blocks, and the window manager accessed them directly as needed. For example, if you had an icon or a cursor, the HICON or HCURSOR was really a ...
Comments are closed.0 0
Code

The management of memory for resources in 16-bit Windows, redux

Some time ago, I briefly ran down how 16-bit Windows managed memory for resources. But there's a detail that I neglected to mention: Ownership. As we saw, a resource handle HRSRC was really a pointer to the resource directory entry of the resource from the corresponding module. This could be done with a 16-bit pointer because the segment ...