Showing results for Code - The Old New Thing

Feb 9, 2005
0
0

The dangers of filtering window messages

Raymond Chen
Raymond Chen

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 window-fil...

Code
Feb 8, 2005
0
0

What other effects does DS_SHELLFONT have on property sheet pages?

Raymond Chen
Raymond Chen

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 188dlu t...

CodeHistory
Feb 4, 2005
0
0

What's the deal with the DS_SHELLFONT flag?

Raymond Chen
Raymond Chen

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" loo...

Code
Feb 1, 2005
0
0

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

Raymond Chen
Raymond Chen

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

Code
Jan 21, 2005
0
0

Why are kernel HANDLEs always a multiple of four?

Raymond Chen
Raymond Chen

Not very well known is that the bottom two bits of kernel HANDLEs are always zero; in other words, their numeric value is always a multiple of 4. Note that this applies only to kernel HANDLEs; it does not apply to pseudo-handles or to any other type of handle (USER handles, GDI handles, multimedia handles...) Kernel handles are things you can pas...

Code
Jan 19, 2005
0
0

CreateProcess does not wait for the process to start

Raymond Chen
Raymond Chen

The function creates a new process, but it doesn't wait for the process to get off the ground before returning. It just creates the process object and lets it go to do its thing. The Win32 process model is that each process initializes itself in context. When a process object is created, it is practically empty, save for enough information to g...

Code
Jan 10, 2005
0
0

Taskbar notification balloon tips don't penalize you for being away from the keyboard

Raymond Chen
Raymond Chen

The function is used to do various things, among them, displaying a balloon tip to the user. As discussed in the documentation for the structure, the uTimeout member specifies how long the balloon should be displayed. But what if the user is not at the computer when you display your balloon? After 30 seconds, the balloon will time out, and the...

Code
Jan 10, 2005
0
0

Taskbar notification balloon tips don’t penalize you for being away from the keyboard

Raymond Chen
Raymond Chen

The function is used to do various things, among them, displaying a balloon tip to the user. As discussed in the documentation for the structure, the uTimeout member specifies how long the balloon should be displayed. But what if the user is not at the computer when you display your balloon? After 30 seconds, the balloon will time out, and the...

Code
Jan 5, 2005
0
0

PulseEvent is fundamentally flawed

Raymond Chen
Raymond Chen

The function releases one thread (or all threads, if manual-reset) which is/are waiting for the pulsed event, then returns the event to the unset state. If no threads happen to be waiting, then the event goes to the unset state without anything happening. And there's the flaw. How do you know whether the thread that you think is waiting on t...

Code