Showing results for Code - The Old New Thing

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
Jan 4, 2005
0
0

Using fibers to simplify enumerators, part 5: Composition

Raymond Chen
Raymond Chen

Another type of higher-order enumeration is composition, where one enumerator actually combines the results of multiple enumerators. (Everybody knows about derivation, but composition is another powerful concept in object-oriented programming. We've seen it before when building context menus.) In a producer-driven enumerator, you would implemen...

Code
Jan 3, 2005
0
0

Using fibers to simplify enumerators, part 4: Filtering

Raymond Chen
Raymond Chen

One type of higher-order enumeration is filtering, where one enumerator takes the output of another enumerator and removes some elements. In a producer-driven enumerator, you would implement filtering by substituting a new callback function that responds to callbacks on behalf of the client for items that should be filtered, and forwarding callb...

Code