<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>The Old New Thing</title><link>http://blogs.msdn.com/b/oldnewthing/</link><description>not actually to establish a blogging point where individuals can enrich their learns on facilitating and leveraging .NET-related activities most effectively</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>A question about proper disposal of unwanted items with an unhelpful answer</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/05/21/10420161.aspx</link><pubDate>Tue, 21 May 2013 14:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10420161</guid><dc:creator>Raymond Chen - MSFT</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/oldnewthing/rsscomments.aspx?WeblogPostID=10420161</wfw:commentRss><comments>http://blogs.msdn.com/b/oldnewthing/archive/2013/05/21/10420161.aspx#comments</comments><description>&lt;P&gt;
On an internal mailing list about home maintenance and ownership,
somebody asked:
&lt;/P&gt;
&lt;BLOCKQUOTE CLASS=q&gt;
&lt;P&gt;
I have a handful of items that I need to get rid of and
probably should not toss into the regular garbage.
Any thoughts?
&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Older TV &amp;mdash; 32&amp;Prime;
&lt;LI&gt;Propane tanks (full)
&lt;LI&gt;Lighter fluid
&lt;LI&gt;Carpet glue adhesive
&lt;LI&gt;Lawn fertilizer
&lt;/UL&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;
The best reply was an unhelpful one.
&lt;/P&gt;
&lt;BLOCKQUOTE CLASS=q&gt;
&lt;P&gt;
You've pretty much got all the components you need
to build a bomb.
Why dispose of them?
&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10420161" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/oldnewthing/archive/tags/Non_2D00_Computer/">Non-Computer</category></item><item><title>The importance of remembering parity in a back-and-forth race on your flying bicycle</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/05/20/10419966.aspx</link><pubDate>Mon, 20 May 2013 14:00:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10419966</guid><dc:creator>Raymond Chen - MSFT</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/oldnewthing/rsscomments.aspx?WeblogPostID=10419966</wfw:commentRss><comments>http://blogs.msdn.com/b/oldnewthing/archive/2013/05/20/10419966.aspx#comments</comments><description>&lt;P&gt;
I dreamed that one of my friends had made the U.S. cycling team.
(Perhaps because everybody else got busted for doping.)
Even more implausibly, &lt;I&gt;I&lt;/I&gt; also made the team.
&lt;/P&gt;
&lt;P&gt;
To celebrate, he challenged me to a short race.
The path ran along a river,
in which a medium-sized boat was setting sail.
Our bicycles somehow could fly (which we considered perfectly normal)
and we were flying over the boat, just about keeping pace with it.
&lt;/P&gt;
&lt;P&gt;
The boat reversed direction many times, and we reversed along with it.
At one of the reversals, I thought,
"I could take a shortcut if I kept going straight,"
but I must've lost even/odd count because I flew off the boat...
heading back to the starting line.
&lt;/P&gt;
&lt;P&gt;
&lt;B&gt;Bonus weirdness&lt;/B&gt;:
For some reason,
we were in Sweden,
and the race commentator saw a school labeled
&lt;A HREF="http://en.wikipedia.org/wiki/Gymnasium_(school)"&gt;
Gymnasium&lt;/A&gt;
and made some remark about repurposing buildings
left over from the Olympics.
&lt;/P&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10419966" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/oldnewthing/archive/tags/Non_2D00_Computer/">Non-Computer</category><category domain="http://blogs.msdn.com/b/oldnewthing/archive/tags/Dream/">Dream</category></item><item><title>Copying a file to the clipboard so you can paste it into Explorer or an email message or whatever</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/05/20/10419965.aspx</link><pubDate>Mon, 20 May 2013 14:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10419965</guid><dc:creator>Raymond Chen - MSFT</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/oldnewthing/rsscomments.aspx?WeblogPostID=10419965</wfw:commentRss><comments>http://blogs.msdn.com/b/oldnewthing/archive/2013/05/20/10419965.aspx#comments</comments><description>&lt;P&gt;
Today's Little Program takes a fully-qualified file name
from the command line and puts that file onto the clipboard.
Once there, you can paste it into an Explorer window,
or into an email message,
or a word processing document,
or anybody else who understands shell data objects.
&lt;/P&gt;
&lt;PRE&gt;
#include &amp;lt;windows.h&amp;gt;
#include &amp;lt;shlobj.h&amp;gt;
#include &amp;lt;atlbase.h&amp;gt;
#include &amp;lt;shlobj.h&amp;gt;

class COleInitialize {
public:
 COleInitialize() : m_hr(OleInitialize(NULL)) { }
 ~COleInitialize() { if (SUCCEEDED(m_hr)) OleUninitialize(); }
 operator HRESULT() const { return m_hr; }
 HRESULT m_hr;
};

// &lt;A HREF="http://blogs.msdn.com/b/oldnewthing/archive/2004/09/21/231739.aspx"&gt;GetUIObjectOfFile&lt;/A&gt; incorporated by reference

int __cdecl wmain(int argc, PWSTR argv[])
{
 COleInitialize init;
 CComPtr&amp;lt;IDataObject&amp;gt; spdto;

 if (SUCCEEDED(init) &amp;amp;&amp;amp;
     argc == 2 &amp;amp;&amp;amp;
     SUCCEEDED(GetUIObjectOfFile(nullptr, argv[1], IID_PPV_ARGS(&amp;amp;spdto))) &amp;amp;&amp;amp;
     SUCCEEDED(OleSetClipboard(spdto)) &amp;amp;&amp;amp;
     SUCCEEDED(OleFlushClipboard())) {
  // success
 }

 return 0;
}
&lt;/PRE&gt;
&lt;P&gt;
The &lt;CODE&gt;COle&amp;shy;Initialize&lt;/CODE&gt; class is just the OLE
counterpart to
&lt;A HREF="http://blogs.msdn.com/b/oldnewthing/archive/2004/05/20/135841.aspx"&gt;
the &lt;CODE&gt;CCo&amp;shy;Initialize&lt;/CODE&gt; class we saw some time ago&lt;/A&gt;.
&lt;/P&gt;
&lt;P&gt;
All the program does is take the file name on the command line,
asks the shell for the corresponding data object,
then puts that object onto the clipboard,
&lt;A HREF="http://blogs.msdn.com/b/oldnewthing/archive/2010/05/10/10009448.aspx"&gt;
erasing what was there before&lt;/A&gt;.
&lt;/P&gt;
&lt;P&gt;
Once the data is on the clipboard, our job is done so we exit.
&lt;/P&gt;
&lt;P&gt;
No, wait!
If you exit while your application has data on the clipboard,
that clipboard data may be lost.
The documentation for &lt;CODE&gt;Ole&amp;shy;Set&amp;shy;Clipboard&lt;/CODE&gt;
notes:
&lt;/P&gt;
&lt;BLOCKQUOTE CLASS=q&gt;
If you need to leave the data on the clipboard
after your application is closed,
you should call &lt;B&gt;Ole&amp;shy;Flush&amp;shy;Clipboard&lt;/B&gt;
rather than calling
&lt;B&gt;Ole&amp;shy;Set&amp;shy;Clipboard&lt;/B&gt;
with a &lt;B&gt;NULL&lt;/B&gt; parameter value.
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;
Therefore, we stick in a call to
&lt;CODE&gt;Ole&amp;shy;Flush&amp;shy;Clipboard&lt;/CODE&gt;
before exiting.
This forces any delay-rendered content to be rendered immediately,
because we ain't gonna be around to delay-render it no more.
&lt;/P&gt;
&lt;P&gt;
Note that the file on the command line must be fully-qualified,
because we pass it straight to
&lt;CODE&gt;Get&amp;shy;UI&amp;shy;Object&amp;shy;Of&amp;shy;File&lt;/CODE&gt;,
which expects a fully-qualified path.
Fixing the program to allow relative paths (and to actually
print error messages and stuff) is left as an exercise,
because Little Programs don't deal with annoying details like
error checking and reporting.
&lt;/P&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10419965" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/oldnewthing/archive/tags/Code/">Code</category></item><item><title>Who sends the initial WM_UPDATEUISTATE message?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/05/17/10419502.aspx</link><pubDate>Fri, 17 May 2013 14:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10419502</guid><dc:creator>Raymond Chen - MSFT</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/oldnewthing/rsscomments.aspx?WeblogPostID=10419502</wfw:commentRss><comments>http://blogs.msdn.com/b/oldnewthing/archive/2013/05/17/10419502.aspx#comments</comments><description>&lt;P&gt;
&lt;A HREF="http://blogs.msdn.com/b/oldnewthing/archive/2013/05/16/10419105.aspx"&gt;
Last time&lt;/A&gt;,
we looked at the
confusingly-named
&lt;CODE&gt;WM_&lt;WBR&gt;UPDATE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt;
and
&lt;CODE&gt;WM_&lt;WBR&gt;CHANGE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt;
messages.
But how does the whole indicator thingie get off the ground?
&lt;/P&gt;
&lt;P&gt;
The default state for a window is to show all indicators.
But as a special trick,
the dialog manager will send a
&lt;CODE&gt;WM_&lt;WBR&gt;UPDATE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt; message
with &lt;CODE&gt;UIS_&lt;WBR&gt;INITIALIZE&lt;/CODE&gt; after the dialog
has been initialized,
which turns off the indicators if the last input event
was a mouse event.
This is its way of inferring whether the dialog box was
triggered by a mouse or keyboard action
and setting the initial indicators accordingly.
(Note that if the user checked
&lt;I&gt;Underline keyboard shortcuts and access keys&lt;/I&gt;,
then the dialog manager leaves the indicators enabled
regardless of the last input event.)
&lt;/P&gt;
&lt;P&gt;
That special
&lt;CODE&gt;WM_&lt;WBR&gt;UPDATE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt; message
is what gives dialog boxes the extra special feature
of hiding the keyboard accelerators until you use the keyboard.
&lt;/P&gt;
&lt;P&gt;
But notice that only the dialog manager does this.
If you want this behavior in your own non-dialog windows,
you will need to send the message yourself.
&lt;/P&gt;
&lt;PRE&gt;
BOOL MyWindow::OnCreate(...)
{
 ... create and initialize any child windows ...

 &lt;FONT COLOR=blue&gt;// initialize indicators
 BOOL fAlwaysUnderline = FALSE;
 SystemParametersInfo(SPI_GETKEYBOARDCUES, 0,
                      &amp;amp;fAlwaysUnderline, 0);
 if (!fAlwaysUnderline) {
  SendMessage(this-&amp;gt;m_hwnd, WM_UPDATEUISTATE,
              MAKEWPARAM(UIS_INITIALIZE, 0), 0);
 }&lt;/FONT&gt;
}
&lt;/PRE&gt;
&lt;P&gt;
&lt;B&gt;Exercise&lt;/B&gt;:
Why is it important to create and initialize the child windows
before sending the
&lt;CODE&gt;WM_&lt;WBR&gt;UPDATE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt; message?
&lt;/P&gt;
&lt;P&gt;
&lt;B&gt;Exercise&lt;/B&gt;:
Why can't the window manager do this automatically
after &lt;CODE&gt;WM_&lt;WBR&gt;CREATE&lt;/CODE&gt; returns?
&lt;/P&gt;
&lt;P&gt;
&lt;B&gt;Exercise&lt;/B&gt;:
Explain the behavior this customer observes.
&lt;/P&gt;
&lt;BLOCKQUOTE CLASS=q&gt;
We have a dialog box with three buttons.
Sometimes the dialog displays underlines for the hotkeys,
and sometimes it doesn't.
I know about the feature which hides keyboard accelerators
by default, but that doesn't explain why the setting gets
ignored sometimes.
The first time I show the dialog in my program,
I get the underlines, but the second and subsequent times,
I do not.
&lt;/BLOCKQUOTE&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10419502" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/oldnewthing/archive/tags/Code/">Code</category></item><item><title>Your electric fan is trying to kill you, and other cultural superstitions</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/05/16/10419106.aspx</link><pubDate>Thu, 16 May 2013 14:00:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10419106</guid><dc:creator>Raymond Chen - MSFT</dc:creator><slash:comments>70</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/oldnewthing/rsscomments.aspx?WeblogPostID=10419106</wfw:commentRss><comments>http://blogs.msdn.com/b/oldnewthing/archive/2013/05/16/10419106.aspx#comments</comments><description>&lt;P&gt;
In Korea, it is generally believed that leaving a fan on in an enclosed room
can be fatal.
Ken Jennings
&lt;A HREF="http://www.amazon.com/gp/product/1451656254/&amp;tag=tholneth-20"&gt;
looks at cultural superstitions&lt;/A&gt;
and wrote a Slate article focusing on
&lt;A HREF="http://www.slate.com/articles/life/foreigners/2013/01/fan_death_korean_moms_think_that_your_electric_fan_will_kill_you.html"&gt;
the scourge of Korean fan death&lt;/A&gt;.
&lt;/P&gt;
&lt;P&gt;
My mother told me that handling cellophane tape makes you sterile.
Though that may have just been her way of getting me to stop
playing with cellophane tape.
&lt;/P&gt;
&lt;P&gt;
What strange cultural superstitions exist in your part of the world?
(Of course, this is a bit of an unfair question, because if you genuinely
believe it, then you won't recognize it  as a strange cultural superstition!)
&lt;/P&gt;
&lt;P&gt;
&lt;B&gt;Clarification&lt;/B&gt;: Please reply in the spirit of the article.
Keep it fun.
&lt;/P&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10419106" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/oldnewthing/archive/tags/Non_2D00_Computer/">Non-Computer</category></item><item><title>Untangling the confusingly-named WM_UPDATEUISTATE and WM_CHANGEUISTATE messages</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/05/16/10419105.aspx</link><pubDate>Thu, 16 May 2013 14:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10419105</guid><dc:creator>Raymond Chen - MSFT</dc:creator><slash:comments>11</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/oldnewthing/rsscomments.aspx?WeblogPostID=10419105</wfw:commentRss><comments>http://blogs.msdn.com/b/oldnewthing/archive/2013/05/16/10419105.aspx#comments</comments><description>&lt;P&gt;
I always get confused by the
&lt;CODE&gt;WM_&lt;WBR&gt;UPDATE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt;
and
&lt;CODE&gt;WM_&lt;WBR&gt;CHANGE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt;
messages,
and I have to go figure them out each time I need to mess
with them.
So this time, I'm going to write it down so I don't forget.
Because the act of writing it down helps me to remember.
&lt;/P&gt;
&lt;P&gt;
It's like in school, where the teacher says,
"This is a closed-book, closed-notes exam,
but you are allowed to bring one piece of standard
8&amp;frac12;&amp;Prime;&amp;times;11&amp;Prime; paper with you,
on which you can write anything you like.
No funny business."
You work really hard to create the ultimate sheet of
paper to bring to the exam,
and then it turns out that during the exam,
you barely refer to it at all.
Because the act of deciding what to put on the cheat sheet
made you remember the material.
&lt;/P&gt;
&lt;P&gt;
Part of the problem with the messages
&lt;CODE&gt;WM_&lt;WBR&gt;UPDATE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt;
and
&lt;CODE&gt;WM_&lt;WBR&gt;CHANGE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt;
is their confusing names,
because to most people &lt;I&gt;update&lt;/I&gt; and &lt;I&gt;change&lt;/I&gt;
are basically the same concept.
The difference is the direction the message travels.
Before we look at that, let's look at the mysterious &lt;CODE&gt;WPARAM&lt;/CODE&gt;.
&lt;/P&gt;
&lt;P&gt;
The &lt;CODE&gt;WPARAM&lt;/CODE&gt; specifies what action you want
to perform (initialize, set, or clear)
and the target of the action (focus, accelerators, or both).
&lt;/P&gt;
&lt;TABLE BORDER=1 BORDERCOLOR=black STYLE="border-collapse: collapse"&gt;
&lt;TR&gt;
    &lt;TH&gt;Action&lt;/TH&gt;
    &lt;TH&gt;Meaning&lt;/TH&gt;
&lt;/TR&gt;
&lt;TR&gt;
    &lt;TD&gt;&lt;CODE&gt;UIS_SET&lt;/CODE&gt;&lt;/TD&gt;
    &lt;TD&gt;Set the flag (hide the indicator).&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
    &lt;TD&gt;&lt;CODE&gt;UIS_CLEAR&lt;/CODE&gt;&lt;/TD&gt;
    &lt;TD&gt;Clear the flag (show the indicator).&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
    &lt;TD&gt;&lt;CODE&gt;UIS_INITIALIZE&lt;/CODE&gt;&lt;/TD&gt;
    &lt;TD&gt;Set or clear the flag
    based on whether the last input event was mouse (set)
    or keyboard (clear).&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TABLE&gt;
&lt;P&gt;
Setting a flag hides the corresponding indicator.
For example, if you have a &lt;CODE&gt;UIS_&lt;WBR&gt;SET&lt;/CODE&gt; for
&lt;CODE&gt;UISF_&lt;WBR&gt;HIDE&amp;shy;FOCUS&lt;/CODE&gt;, that means that
you want to hide focus indicators.
&lt;/P&gt;
&lt;P&gt;
Clearing a flag shows the corresponding indicator.
For example, if you have a &lt;CODE&gt;UIS_&lt;WBR&gt;CLEAR&lt;/CODE&gt; for
&lt;CODE&gt;UISF_&lt;WBR&gt;HIDE&amp;shy;FOCUS&lt;/CODE&gt;, that means that
you want to show focus indicators.
&lt;/P&gt;
&lt;P&gt;
Yes, it's a bit of a double-negative situation.
&lt;/P&gt;
&lt;P&gt;
Each window has its own internal state that remembers
which indicators have been hidden for that window.
You can query this state by sending the window
a &lt;CODE&gt;WM_&lt;WBR&gt;QUERY&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt; message.
&lt;/P&gt;
&lt;P&gt;
The
&lt;CODE&gt;WM_&lt;WBR&gt;UPDATE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt;
message travels down the tree:
When a window receives the
&lt;CODE&gt;WM_&lt;WBR&gt;UPDATE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt; message,
it updates its state according to the &lt;CODE&gt;WPARAM&lt;/CODE&gt;
and then forwards the message to its children.
Therefore, if you want to change the state for an entire
window tree,
you can send the
&lt;CODE&gt;WM_&lt;WBR&gt;UPDATE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt; message
to the top-level window,
and the message will be delivered to that window and all
its children.
&lt;/P&gt;
&lt;P&gt;
It's called &lt;I&gt;update&lt;/I&gt; because it says,
"Okay, listen up everybody,
this is what we're going to do."
&lt;/P&gt;
&lt;P&gt;
The
&lt;CODE&gt;WM_&lt;WBR&gt;CHANGE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt; message
is more like a change &lt;I&gt;request&lt;/I&gt;.
It travels up the tree:
When a window receives the message,
it sees if the state being requested matches the
window's current state.
If so, then processing stops since there is nothing to change.
Otherwise, the window forwards the message to its parent.
The idea here is to push the change request up the tree
until it finds the top-level window.
&lt;/P&gt;
&lt;P&gt;
If a top-level window receives a
&lt;CODE&gt;WM_&lt;WBR&gt;CHANGE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt; message
for a state change that actually changes something,
it turns around and sends itself a
&lt;CODE&gt;WM_&lt;WBR&gt;UPDATE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt;
message, which as we saw before,
tells the entire window tree to set its indicator state
to the value specified.
&lt;/P&gt;
&lt;P&gt;
Okay, let's draw a picture.
Suppose we have a top-level window with two children,
and suppose that everybody starts out with all indicators hidden.
&lt;/P&gt;
&lt;TABLE&gt;
&lt;TR&gt;
&lt;TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0
       SUMMARY="A top-level window named A, with children B and C. All of them are marked hideFocus=1 and hideAccel=1"&gt;
&lt;TR&gt;
&lt;TD STYLE="width: 3em"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD STYLE="width: 3em"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD STYLE="width: 3em"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD STYLE="width: 3em"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD STYLE="width: 3em"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD STYLE="width: 3em"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
    &lt;TD COLSPAN=2 STYLE="width: 6em"&gt;&amp;nbsp;&lt;/TD&gt;
    &lt;TD COLSPAN=2 ALIGN=center
         STYLE="border: solid black .75pt; height: 3em; width: 6em;"&gt;
    &lt;FONT SIZE=+2&gt;A&lt;/FONT&gt;&lt;BR&gt;hideFocus=1&lt;BR&gt;hideAccel=1&lt;/TD&gt;
    &lt;TD COLSPAN=2 STYLE="width: 6em"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
    &lt;TD STYLE="width: 3em"&gt;&amp;nbsp;&lt;/TD&gt;
    &lt;TD COLSPAN=2
        STYLE="width: 6em; border-bottom: solid black .75pt;
                           border-right: solid black .75pt"&gt;&amp;nbsp;&lt;/TD&gt;
    &lt;TD COLSPAN=2
        STYLE="width: 6em; border-bottom: solid black .75pt"&gt;&amp;nbsp;&lt;/TD&gt;
    &lt;TD STYLE="width: 3em"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
    &lt;TD STYLE="width: 3em"&gt;&amp;nbsp;&lt;/TD&gt;
    &lt;TD COLSPAN=4
        STYLE="width:12em; border-left: solid black .75pt;
                          border-right: solid black .75pt"&gt;&amp;nbsp;&lt;/TD&gt;
    &lt;TD STYLE="width: 3em"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
    &lt;TD COLSPAN=2 ALIGN=center
        STYLE="border: solid black .75pt; height: 3em; width: 6em;"&gt;
    &lt;FONT SIZE=+2&gt;B&lt;/FONT&gt;&lt;BR&gt;hideFocus=1&lt;BR&gt;hideAccel=1&lt;/TD&gt;
    &lt;TD COLSPAN=2 STYLE="width: 6em"&gt;&amp;nbsp;&lt;/TD&gt;
    &lt;TD COLSPAN=2 ALIGN=center
        STYLE="border: solid black .75pt; height: 3em; width: 6em;"&gt;
    &lt;FONT SIZE=+2&gt;C&lt;/FONT&gt;&lt;BR&gt;hideFocus=1&lt;BR&gt;hideAccel=1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TABLE&gt;
&lt;P&gt;
Window&amp;nbsp;B decides that it wants to show accelerators,
say because the user tapped the &lt;KBD&gt;Alt&lt;/KBD&gt; key.
It sends itself a
&lt;CODE&gt;WM_&lt;WBR&gt;CHANGE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt;
message with a &lt;CODE&gt;wParam&lt;/CODE&gt; of
&lt;CODE&gt;MAKEWPARAM(&lt;WBR&gt;UIS_&lt;WBR&gt;CLEAR, UISF_&lt;WBR&gt;HIDE&amp;shy;ACCEL)&lt;/CODE&gt;.
&lt;/P&gt;
&lt;P&gt;
The
&lt;CODE&gt;WM_&lt;WBR&gt;CHANGE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt;
message handler for Window&amp;nbsp;B
sees that the &lt;CODE&gt;UISF_&lt;WBR&gt;HIDE&amp;shy;ACCEL&lt;/CODE&gt;
flag is set,
so the &lt;I&gt;clear&lt;/I&gt; action is meaningful.
It forwards the request to its parent, Window&amp;nbsp;A.
&lt;/P&gt;
&lt;P&gt;
The
&lt;CODE&gt;WM_&lt;WBR&gt;CHANGE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt;
message handler for Window&amp;nbsp;A
also sees that the &lt;CODE&gt;UISF_&lt;WBR&gt;HIDE&amp;shy;ACCEL&lt;/CODE&gt;
flag is set,
so the &lt;I&gt;clear&lt;/I&gt; action is meaningful.
Since it has no parent, Window&amp;nbsp;A converts the
&lt;CODE&gt;WM_&lt;WBR&gt;CHANGE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt;
message to a
&lt;CODE&gt;WM_&lt;WBR&gt;UPDATE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt;
message and sends it to itself.
&lt;/P&gt;
&lt;P&gt;
The
&lt;CODE&gt;WM_&lt;WBR&gt;UPDATE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt;
message handler for Window&amp;nbsp;A
sees that it is being told to clear the &lt;CODE&gt;UISF_&lt;WBR&gt;HIDE&amp;shy;ACCEL&lt;/CODE&gt;
flag,
so it clears the flag and then forwards the mesage to both its children.
&lt;/P&gt;
&lt;P&gt;
Each of the child windows B&amp;nbsp;and&amp;nbsp;C receive the
&lt;CODE&gt;WM_&lt;WBR&gt;UPDATE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt; message
and see that they are also being told to clear the
&lt;CODE&gt;UISF_&lt;WBR&gt;HIDE&amp;shy;ACCEL&lt;/CODE&gt;
flag,
so they do so.
Those windows have no children of their own, so message processing stops.
By this mechanism, Window&amp;nbsp;B has managed to convince
all the other windows in the hierarchy to clear the
&lt;CODE&gt;UISF_&lt;WBR&gt;HIDE&amp;shy;ACCEL&lt;/CODE&gt; flag.
&lt;/P&gt;
&lt;TABLE&gt;
&lt;TR&gt;
&lt;TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0
       SUMMARY="A top-level window named A, with children B and C. All of them are marked hideFocus=1 and hideAccel=0"&gt;
&lt;TR&gt;
&lt;TD STYLE="width: 3em"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD STYLE="width: 3em"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD STYLE="width: 3em"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD STYLE="width: 3em"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD STYLE="width: 3em"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD STYLE="width: 3em"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
    &lt;TD COLSPAN=2 STYLE="width: 6em"&gt;&amp;nbsp;&lt;/TD&gt;
    &lt;TD COLSPAN=2 ALIGN=center
         STYLE="border: solid black .75pt; height: 3em; width: 6em;"&gt;
    &lt;FONT SIZE=+2&gt;A&lt;/FONT&gt;&lt;BR&gt;hideFocus=1&lt;BR&gt;hideAccel=0&lt;/TD&gt;
    &lt;TD COLSPAN=2 STYLE="width: 6em"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
    &lt;TD STYLE="width: 3em"&gt;&amp;nbsp;&lt;/TD&gt;
    &lt;TD COLSPAN=2
        STYLE="width: 6em; border-bottom: solid black .75pt;
                           border-right: solid black .75pt"&gt;&amp;nbsp;&lt;/TD&gt;
    &lt;TD COLSPAN=2
        STYLE="width: 6em; border-bottom: solid black .75pt"&gt;&amp;nbsp;&lt;/TD&gt;
    &lt;TD STYLE="width: 3em"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
    &lt;TD STYLE="width: 3em"&gt;&amp;nbsp;&lt;/TD&gt;
    &lt;TD COLSPAN=4
        STYLE="width:12em; border-left: solid black .75pt;
                          border-right: solid black .75pt"&gt;&amp;nbsp;&lt;/TD&gt;
    &lt;TD STYLE="width: 3em"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
    &lt;TD COLSPAN=2 ALIGN=center
        STYLE="border: solid black .75pt; height: 3em; width: 6em;"&gt;
    &lt;FONT SIZE=+2&gt;B&lt;/FONT&gt;&lt;BR&gt;hideFocus=1&lt;BR&gt;hideAccel=0&lt;/TD&gt;
    &lt;TD COLSPAN=2 STYLE="width: 6em"&gt;&amp;nbsp;&lt;/TD&gt;
    &lt;TD COLSPAN=2 ALIGN=center
        STYLE="border: solid black .75pt; height: 3em; width: 6em;"&gt;
    &lt;FONT SIZE=+2&gt;C&lt;/FONT&gt;&lt;BR&gt;hideFocus=1&lt;BR&gt;hideAccel=0&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TABLE&gt;
&lt;P&gt;
Now, suppose that Window&amp;nbsp;C also decides to clear the accelerator
indicator.
It does the same thing as Window&amp;nbsp;B and sends itself a
&lt;CODE&gt;WM_&lt;WBR&gt;CHANGE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt;
message with a &lt;CODE&gt;wParam&lt;/CODE&gt; of
&lt;CODE&gt;MAKEWPARAM(&lt;WBR&gt;UIS_&lt;WBR&gt;CLEAR, UISF_&lt;WBR&gt;HIDE&amp;shy;ACCEL)&lt;/CODE&gt;.
This time, the
&lt;CODE&gt;WM_&lt;WBR&gt;CHANGE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt;
message handler for Window&amp;nbsp;C
sees that the &lt;CODE&gt;UISF_&lt;WBR&gt;HIDE&amp;shy;ACCEL&lt;/CODE&gt;
flag is already clear,
so the &lt;I&gt;clear&lt;/I&gt; action is redundant.
Message processing stops.
&lt;/P&gt;
&lt;P&gt;
These two examples show
the flow of the UI state change messages.
When somebody wants to suggest a change to the UI state,
they send themselves a
&lt;CODE&gt;WM_&lt;WBR&gt;CHANGE&amp;shy;UI&amp;shy;STATE&lt;/CODE&gt;
message with a description of what they want to change.
The above algorithm then kicks in to decide whether the change
is meaningful,
and if so, it notifies all the other windows in the hierarchy
about the new state.
&lt;/P&gt;
&lt;P&gt;
&lt;!-- forwardref: --&gt;
Next time&lt;/A&gt;,
we'll look at how this whole indicator state thing
gets off the ground.
&lt;/P&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10419105" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/oldnewthing/archive/tags/Code/">Code</category></item><item><title>Hey look, now I'm Director of Strategic Planning, oh, and my name also changed to Oliver Lee</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/05/15/10418647.aspx</link><pubDate>Wed, 15 May 2013 14:00:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10418647</guid><dc:creator>Raymond Chen - MSFT</dc:creator><slash:comments>16</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/oldnewthing/rsscomments.aspx?WeblogPostID=10418647</wfw:commentRss><comments>http://blogs.msdn.com/b/oldnewthing/archive/2013/05/15/10418647.aspx#comments</comments><description>&lt;P&gt;
It looks like the Visio blog
&lt;A HREF="http://blogs.office.com/b/visio/archive/2013/04/18/data-linked-diagrams-creating-a-diagram-in-visio.aspx"&gt;
populated a sample organizational chart
with pictures of Microsoft employees&lt;/A&gt;,
and I am now Oliver Lee, Director of Strategic Planning.
&lt;/P&gt;
&lt;P&gt;
My secret identity has been revealed.
I'm moonlighting at Contoso.
&lt;/P&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10418647" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/oldnewthing/archive/tags/Non_2D00_Computer/">Non-Computer</category></item><item><title>What does GDI use biXPelsPerMeter and SetBitmapDimensionEx for?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/05/15/10418646.aspx</link><pubDate>Wed, 15 May 2013 14:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10418646</guid><dc:creator>Raymond Chen - MSFT</dc:creator><slash:comments>16</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/oldnewthing/rsscomments.aspx?WeblogPostID=10418646</wfw:commentRss><comments>http://blogs.msdn.com/b/oldnewthing/archive/2013/05/15/10418646.aspx#comments</comments><description>&lt;P&gt;
What does GDI use
&lt;CODE&gt;BITMAP&amp;shy;INFO&amp;shy;HEADER.&lt;WBR&gt;biXPels&amp;shy;Per&amp;shy;Meter&lt;/CODE&gt;
and
&lt;CODE&gt;Set&amp;shy;Bitmap&amp;shy;Dimension&amp;shy;Ex&lt;/CODE&gt;
for?
&lt;/P&gt;
&lt;P&gt;
Nothing.
&lt;/P&gt;
&lt;P&gt;
The
&lt;CODE&gt;BITMAP&amp;shy;INFO&amp;shy;HEADER.&lt;WBR&gt;biXPels&amp;shy;Per&amp;shy;Meter&lt;/CODE&gt;
and
&lt;CODE&gt;BITMAP&amp;shy;INFO&amp;shy;HEADER.&lt;WBR&gt;biYPels&amp;shy;Per&amp;shy;Meter&lt;/CODE&gt;
are completely ignored by GDI when loading a bitmap.
The values are there for the benefit of image-editing programs
who want to record additional information about the bitmap,
but GDI ignores them.
&lt;/P&gt;
&lt;P&gt;
Similarly, the
&lt;CODE&gt;Set&amp;shy;Bitmap&amp;shy;Dimension&amp;shy;Ex&lt;/CODE&gt;
and
&lt;CODE&gt;Get&amp;shy;Bitmap&amp;shy;Dimension&amp;shy;Ex&lt;/CODE&gt;
functions update a &lt;CODE&gt;SIZE&lt;/CODE&gt; structure
associated with each bitmap,
but GDI does nothing with the values,
aside from initializing them to zero when the bitmap is created.
&lt;/P&gt;
&lt;P&gt;
The value is there so that, for example,
a program which puts a bitmap on the clipboard can
specify the recommended physical dimensions of the bitmap,
in order to help
another program that reads the bitmap from the clipboard
(for example, a word processor)
decide how big to resize the bitmap when it is pasted.
&lt;/P&gt;
&lt;P&gt;
Whether any programs actually do this sort of thing I do not know.
&lt;/P&gt;
&lt;P&gt;
But that's what it's there for, in case anybody wanted to do it.
&lt;/P&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10418646" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/oldnewthing/archive/tags/Code/">Code</category></item><item><title>Microspeak: booked</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/05/14/10418267.aspx</link><pubDate>Tue, 14 May 2013 14:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10418267</guid><dc:creator>Raymond Chen - MSFT</dc:creator><slash:comments>10</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/oldnewthing/rsscomments.aspx?WeblogPostID=10418267</wfw:commentRss><comments>http://blogs.msdn.com/b/oldnewthing/archive/2013/05/14/10418267.aspx#comments</comments><description>&lt;P&gt;
Remember, the term Microspeak is not
&lt;A HREF="http://blogs.msdn.com/b/oldnewthing/archive/2012/04/10/10292051.aspx"&gt;
tightly scoped to&lt;/A&gt;
mean jargon used only at Microsoft.
It's jargon used at Microsoft &lt;I&gt;more often than in general usage&lt;/I&gt;.
Today, it's a term that you really need to master if you want
to talk with others about project planning.
&lt;/P&gt;
&lt;P&gt;
To &lt;I&gt;book&lt;/I&gt; a feature is to commit to implementing the feature,
including assigning resources to get it done.
This means finding designers to design the feature,
developers to implement it,
and testers to test it,
as well as (the hardest part) finding time in the schedule to do it.
The resource that is in shortest supply is usually time,
since there is no way to create more of it.
&lt;/P&gt;
&lt;P&gt;
More generally, a resource is booked when it is committed to
doing something.
This is a natural extension of the concept of booking a room
in a hotel or a seat on a train.
&lt;/P&gt;
&lt;P&gt;
Here are some citations.
&lt;/P&gt;
&lt;BLOCKQUOTE CLASS=q&gt;
We will be using the Widget framework that Bob is booked
to finish in July.
&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE CLASS=q&gt;
There are no resources booked for enhancing the Widget framework
this release cycle.
&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE CLASS=q&gt;
The Widget team knows that we need this feature from them,
but they haven't booked it yet,
so we need to develop a fallback plan.
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;
The term is in general use,
but for some reason, Microspeak uses it almost exclusively
to describe the commitment to completing a particular piece of work
by a particular date.
Instead of saying that the work is &lt;I&gt;committed&lt;/I&gt; or
&lt;I&gt;scheduled&lt;/I&gt; or
&lt;I&gt;confirmed&lt;/I&gt;,
we say that it is &lt;I&gt;booked&lt;/I&gt;.
(If you use one of the other words, people may ask for clarification.
For example, if you say that it is &lt;I&gt;committed&lt;/I&gt;,
some people might think you mean that the change has already been
submitted to the source code repository.)
&lt;/P&gt;
&lt;P&gt;
Curiously the antonym of &lt;I&gt;booked&lt;/I&gt; is not &lt;I&gt;unbooked&lt;/I&gt;.
If a feature has no resources assigned to it,
the preferred term is &lt;I&gt;unfunded&lt;/I&gt;.
&lt;/P&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10418267" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/oldnewthing/archive/tags/Non_2D00_Computer/">Non-Computer</category></item><item><title>The secret lair of Administrative Assistants</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/05/13/10417965.aspx</link><pubDate>Mon, 13 May 2013 14:00:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10417965</guid><dc:creator>Raymond Chen - MSFT</dc:creator><slash:comments>12</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/oldnewthing/rsscomments.aspx?WeblogPostID=10417965</wfw:commentRss><comments>http://blogs.msdn.com/b/oldnewthing/archive/2013/05/13/10417965.aspx#comments</comments><description>&lt;P&gt;
I dreamed that a colleague and I were looking for a copy
of a TN3270 emulator in order to investigate a bug.
The search took us into an abandoned-looking Building&amp;nbsp;5.
But upon entering,
we discovered that Building&amp;nbsp;5 was actually the secret
lair of all the Administrative Assistants.
&lt;/P&gt;
&lt;P&gt;
Oh, and we eventually found the bug in TN3270.
It was an application bug that caused it to leave the
laser on for too long in one spot,
causing it to burn your thumb.
&lt;/P&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10417965" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/oldnewthing/archive/tags/Non_2D00_Computer/">Non-Computer</category><category domain="http://blogs.msdn.com/b/oldnewthing/archive/tags/Dream/">Dream</category></item></channel></rss>