The Old New Thing

Modality, part 2: Code-modality vs UI-modality

Last time, we saw an example of code that was UI-modal but not code-modal. The opposite is also true: You can have code-modality without UI-modality. In fact, this is far more common than the UI-modal-but-not-code-modal scenario. You encounter modal loops without a visible change in UI state when you drag the scroll bar thumb, drag the window...

Modality, part 1: UI-modality vs code-modality

From the end-users' point of view, modality occurs when the users are locked into completing a task once it is begun, with the only escape being to cancel the entire operation. Opening a file is an example of a modal operation: Once the "Open" command has been selected, users have no choice but to select a file for opening (or to cancel the ...

Limitations of the shell animation control

The Animation control in the shell common controls library supports only a very limited class of AVI files. Why all these restrictions? Because the purpose of the Animation control is to be able to show simple animations. If you have a complex animation, you should be using one of the more advanced animation controls, like the MCIWnd ...

You cannot globally reserve user-mode address space

Occasionally, somebody asks for a way to reserve user-mode address space globally. In other words, they want to allocate address space in all processes in the system (current and future). Typically this is because they want to map some memory into each process and don't want to go through the trouble of designing the shared memory blocks so ...

LoadLibraryEx(DONT_RESOLVE_DLL_REFERENCES) is fundamentally flawed

There is a flag to the function called . The documentation says, If this value is used, and the executable module is a DLL, the system does not call DllMain for process and thread initialization and termination. Also, the system does not load additional executable modules that are referenced by the specified module. If you are ...

The dangers of filtering window messages

The and functions allow you to pass a filter, restricting the window handle or range of messages that the function will retrieve from the message queue. While it's okay to use these filters, make sure you eventually get around to making an unfiltered call so that any straggling messages can come through. A common mistake is to use a ...

What other effects does DS_SHELLFONT have on property sheet pages?

Once you invent a new flag you can start using it to fix errors of the past without breaking backwards compatibility. One of the errors of the past was that property sheet page dimensions were taken relative to the "MS Sans Serif" font, even if the page used some other font. This sample dialog template says that it is 212dlu wide and ...

What's the deal with the DS_SHELLFONT flag?

It indicates that you want the Windows 2000 default shell font. But that doesn't mean that you're going to get it. In order to indicate that you would like the "Windows 2000" look for your dialog, you have to do three things and hope for a fourth: If all four conditions are satisfied, then your dialog gets the "Windows 2000...

How to detect programmatically whether you are running on 64-bit Windows

To detect programmatically whether your 32-bit program is running on 64-bit Windows, you can use the IsWow64Process function. Do not do as some people do and hard-code the list of 64-bit processors. You'd think that after the hard-coded list of 64-bit processors changed the first time (when x64 was added to ia64), people would have learned...