February 5th, 2010

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 DWMWA_FORCE_ICONIC_REPRESENTATION and DWMWA_HAS_ICONIC_BUTMAP DWMWA_HAS_ICONIC_BITMAP [corrected 8am] attributes set, yet I never receive a WM_DWMSENDICONICTHUMBNAIL message in my window procedure.

A member of the taskbar team invoked psychic powers:

Is your program running elevated by any chance? If so, then you need to add the WM_DWMSENDICONICTHUMBNAIL message to your UIPI message filter:

ChangeWindowMessageFilter(WM_DWMSENDICONICTHUMBNAIL, MSGFLT_ADD);

Psychic powers once again save the day.

That was it. Thanks!

Note that forcing someone to invoke psychic powers is a bad thing. It means that you withheld crucial information that somebody had to guess at. Here are some crucial pieces of information people tend to forget to mention:

  • “Oh, did I mention that my process is running elevated?”
  • “Oh, did I mention that my process is a service?”
  • “Oh, did I mention that my process is 32-bit, running on a 64-bit machine?”
  • “Oh, did I mention that I initialized COM as MTA?”
  • “Oh, did I mention that my process is impersonating another user?”
  • “Oh, did I mention that I’m running a version of the operating system different from Windows 7?” (or whatever the most current client operating system is)

Added: The reason those items above are crucial pieces of information is that all of them (except the last one) are “game-changers”: If you do any of the things in the list, a whole bunch of rules change. It’s like asking a question about traffic regulations and neglecting to mention that the other vehicle is a fire truck with its siren on. (And presumably when you chose to invoke any of those game-changing conditions, you were aware of the rules which applied to the new situation. Those rules are documented with the game-changing condition, not with the general description of a normally-functioning universe. Imagine if every physics book had the sentence “This rule does not apply to Superman” at the end of every paragraph.)

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.