The Old New Thing

What happens if I call KillTimer with a NULL hwnd?

A customer discovered a bug in their code and wanted some information on how serious it was, so they could assess how urgently they need to issue a fix. We have code that calls with a valid window handle, but then we destroy the window before we get around to calling . When we finally do call , we do so with a window handle. The calls are ...
Comments are closed.0 0
Code

Hazards of spelling autocorrection: defiance

On an internal mailing list, a colleague asked for some recommendations on a webcam. I was wondering if there are any models I should avoid or defiantly get. I got this mental image of my colleague giving the salesperson the finger as he handed over his credit card. My colleague explained, "That's an error I frequently make because Outlook...

If my window hosts multiple windowless ActiveX controls, which one do I call IOleInPlaceActiveObject::TranslateAccelerator and IOleInPlaceObjectWindowless::OnWindowMessage on?

Commenter Farproc asks how one goes about hosting two windowless ActiveX controls in a single window. In particular, "none of the documentation explains how to choose which control to send and on?" Actually, the documentation does say. The documentation for says, "Active in-place objects must always be given the first chance at ...
Comments are closed.0 0
Code

The extern "C" specifier disables C++ mangling, but that doesn't mean it disables mangling

The MSDN documentation on dllexport contains the following enigmatic paragraph, or at least did at the time I wrote this article: dllexport of a C++ function will expose the function with C++ name mangling. If C++ name mangling is not desired, either use a .def file (EXPORTS keyword) or declare the function as extern "C". I've seen this ...
Comments are closed.0 0
Code

How do I prevent unchecked checkboxes in my listview control from disappearing?

A customer asked, "I have a listview control in report view with the extended style. I noticed that unchecked checkboxes are not visible until I hover over the corresponding item. Is it possible to get the checkboxes to be visible all the time?" I was kind of puzzled by this question because the default behavior of the list view control is ...
Comments are closed.0 0
Code

GUIDs are designed to be unique, not random

A customer liaison asked, "My customer is looking for information on the GUID generation algorithm. They need to select N items randomly from a pool of M (jury selection), and their proposed algorithm is to assign each item a GUID, then sort the items by GUID and take the first N." (I've seen similar questions regarding using ...
Comments are closed.0 0
Code

Why is the Close button in the upper right corner?

Chris wants to know how the close button ended up to the right of the minimize and maximize/restore buttons. "In OS/2, it is on the left, which left the two other buttons in place." I don't know why the Close button went to the upper right instead of going to the left of the other buttons, but I'm going to guess. (That's what I do around ...

What was the registry like in 16-bit Windows?

Commenter Niels wonders when and how the registry was introduced to 16-bit Windows and how much of it carried over to Windows 95. The 16-bit registry was extremely simple. There were just keys, no values. The only hive was . All it was used for was COM objects and file associations. The registry was stored in the file, and its ...

How to view the stack of threads that were terminated as part of process teardown from user mode

Last time we saw how to view the stack of threads that were terminated as part of process teardown from the kernel debugger. You can do the same thing from a user-mode debugger, and it's actually a bit easier there. (The user-mode debugger I'm using is the one that comes with the Debugging Tools for Windows, the debugging engine that goes ...