Showing results for October 2013 - Page 3 of 3 - The Old New Thing

Oct 10, 2013
0
0

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

Raymond Chen
Raymond Chen

We saw some time ago how the window manager decides where to place a newly-created window if you pass the 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 for the width and height, then the bottom right corner will be down near the bottom right corner of the scre...

Code
Oct 9, 2013
0
0

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

Raymond Chen
Raymond Chen

You want to use the TAB key to navigate through a non-dialog, so you call in your message loop, but it doesn't work! The problem here is that you are passing the wrong window handle to . The first parameter to is the dialog-like window you want to be able to navigate through. But the code above passes the window that received the message, so...

Code
Oct 8, 2013
0
0

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

Raymond Chen
Raymond Chen

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 the tri...

Non-Computer
Oct 8, 2013
0
0

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

Raymond Chen
Raymond Chen

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 was loa...

History
Oct 7, 2013
0
0

But instead, they decided to build the Great Wheel

Raymond Chen
Raymond Chen

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 clear. I...

Non-ComputerDream
Oct 7, 2013
0
0

Printing the contents of the clipboard as text to stdout

Raymond Chen
Raymond Chen

The 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 it .) 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 first 0x10000000 bytes. Why do I stop at 256MB? Because I'm lazy and ...

Code
Oct 4, 2013
0
0

What's the difference between CopyIcon and DuplicateIcon?

Raymond Chen
Raymond Chen

There are two functions that can be used to create one icon that is identical to another. One of them is . The other is . 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 to clone an icon: . Windows 3...

Code
Oct 3, 2013
0
0

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

Raymond Chen
Raymond Chen

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

Code
Oct 2, 2013
0
0

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

Raymond Chen
Raymond Chen

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 or was really a resource handle, and wh...

Code
Oct 1, 2013
0
0

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

Raymond Chen
Raymond Chen

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 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 portion of th...

History