The Old New Thing

When does STARTF_USESHOWWINDOW override the parameter passed to ShowWindow()?

kokorozashi wants to know what the rules are which govern when the second parameter to is overridden by the flag. The guiding principle is that the parameter is ignored if the window manager thinks that the window you're creating is the application's main window. The details behind the implementation of this principle change over time, so...

It's fine to use fibers, but everybody has to be on board with the plan

We saw fibers a long time ago when I looked at how you can use fibers as a form of coroutines to simplify the writing of enumerators. A fiber is a handy tool, but it's a tool with very sharp edges. Since fibers are promiscuous with threads, you have to be careful when running code that cares about what thread it is running on, because that ...

What happens to the fibers which ran on a thread when the thread exits?

What happens to the fibers which ran on a thread when the thread exits? Are all the fibers destroyed? No, only the currently-executing fiber is destroyed. Fibers running on other threads and fibers which are not running on any thread at all are not affected. Fibers do not have thread affinity (when not running), and they do not remember what...

Custom navigation in dialog boxes, redux

SuperBK asks, "What's the proper way to add keyboard support to a dialog box?" There are many options available to you. The most traditional way is to pick them off in the dialog loop, either hard-coding the keys in code or putting them into resources by moving them to an accelerator resource. Moving them to an accelerator resource is a ...

The normal string manipulation functions stop on a null terminator, so be careful when manipulating double-null-terminated strings

One of the many gotchas of working with double-null-terminated strings is accidentally using functions on them which were designed to operate on single-null-terminated strings. Now, you do need to use those single-null-terminated strings, but you also need to know when they won't do what you want. One of the responses to my psychic ...

Private classes, superclassing, and global subclassing

In the suggestion box, A. Skrobov asks why it's impossible to superclass , but the example that follows is not actually superclassing. When I register my own class under this atom, and leave NULL in WNDCLASS.hInstance, Windows fills it in for me. Then I have two distinct classes registered: (0,WC_DIALOG) and (hMyInstance,WC_DIALOG), and ...

How do I get information about the target of a symbolic link?

Functions like and , when asked to provide information about a symbolic link, returns information about the link itself and not the link destination. If you use the function, you can tell that you have a symbolic link because the file attributes will have the flag set, and the member will contain the special value . Okay, great, so now I ...

Why doesn't my program receive the WM_DWMSENDICONICTHUMBNAIL message when I ask for an iconic representation?

A customer was having trouble adding Windows 7 taskbar integration features to their application: I'm trying to use the new Windows 7 taskbar integration features, but am running into a problem. I've made certain that my program has the and [corrected 8am] attributes set, yet I never receive a message in my window procedure...