Date: | June 26, 2007 / year-entry #230 |
Tags: | code |
Orig Link: | https://blogs.msdn.microsoft.com/oldnewthing/20070626-00/?p=26263 |
Comments: | 18 |
Summary: | From a purely theoretical point of view, there is only one "want" code you really need: DLGC_WANTMESSAGE. All the others are just conveniences. For example, returning DLGC_WANTARROWS means "I want this message if it is an arrow key; otherwise, I don't care." It lets you write case WM_GETDLGCODE: return DLGC_WANTARROWS; instead of the more cumbersome... |
From a purely theoretical point of view, there is only one "want" code
you really need: case WM_GETDLGCODE: return DLGC_WANTARROWS; instead of the more cumbersome (but equivalent) case WM_GETDLGCODE: if (lParam && ((MSG*)lParam)->message == WM_KEYDOWN && (wParam == VK_LEFT || wParam == VK_RIGHT || wParam == VK_UP || wParam == VK_DOWN)) { return DLGC_WANTMESSAGE; } return 0;
Similarly,
And that leaves #define DLGC_WANTALLKEYS 0x0004 #define DLGC_WANTMESSAGE 0x0004
They mean the same thing but look at the situation
through different perspectives.
The It's like when you're at the grocery store, and the bagger asks you, "Would you like me to help you carry your watermelon to your car?" You can say "Yes" or "Always"; the result is the same. The only difference is one of expectation: If you expect to meet the same bagger in the future, and the bagger remembers, then "Always" implies "You don't need to ask me again." The dialog manager, on the other hand, doesn't have that good of a memory, and in fact, if you think about it, you don't want it to have a good memory.
Suppose the dialog manager remembered whether you said "Always"
and stopped asking you in the
future.⊶
It sends the Continuing the analogy, if you want the bagger to help you if it is raining but not on a dry day, you can either look out the window, confirm that it is not raining, and say, "Yes", or you can just say, "Yes, if it's raining," regardless of the weather, and let the bagger make the call. (Of course, the analogy breaks down because the bagger might have a different assessment from you as to whether or not it is raining. The decisions you leave up to the dialog manager, such as whether a key is the tab key or not, are much less ambiguous.) Next time, we'll look at a dialog manager problem, and the information you learned today may come in handy in solving it. Nitpicker's corner ⊶Beginning of counterfactual discussion.* ⊷End of counterfactual discussion.* *Warning: Comments complaining about my choice of footnote symbol will be misrepresented and ridiculed. |
Comments (18)
Comments are closed. |
Shouldn’t the ‘warning’ use a footnote symbol of yellow triangle with an exclamation mark in it? </t-in-c>
These footnotes were brought to you by:
U+22B6 ORIGINAL OF
U+22B7 IMAGE OF
U+002A ASTERISK
"⚠"
@gkdada
The warning and any other symbols used in this blog are at the discretion of the blog owner.
JamesNT
Shouldn’t that be ((MSG*)lParam)->wParam == VK_LEFT || … instead of wParam == VK_LEFT || …
Ivo
Shouldn’t the footnote symbols be superscripted?
I like your choices of footnote symbols!
I think every publication, scholarly or otherwise, should use (a) randomly selected symbol(s) on each page. Of course, the footnote symbol should match the callout or we’ll get (more) confused (than we already are).
Besides, some of those symbols are under-utilized, and they might get lonely and depressed if they are never allowed out.
:rolleyes:
<sup>1</sup>
I like your choices of footnote symbols, with one caveat — they should be reversed.
The filled dot should represent the factual information (ie, fill of info), while the empty dot should be the counterfactual (ie, devoid of facts)
cheech,
I did not know DLGC_WANTALLKEYS and DLGC_WANTMESSAGE had the same value.
even MFC has "DLGC_WANTALLKEYS | DLGC_WANTMESSAGE ".
Some people might like being misrepresented and ridiculed!
While cute, the random footnote symbols (at least this time) don’t automatically stand out as footnotes. I just assumed that my Firefox was misinterpreting some IE-only characters.
Would I be correct to remember some sort of anomaly with cancelling dropdown listboxes, and using DLGC defines?
All I really remember was having a mare along the lines of those damn defines that MFC toolbars throw at you.
Ahhhhhh the (ex) joys of LM_MRUWIDTH.
Baggers rarely if ever ask me if I want help carrying out my groceries, so the analogy is invalid.
ScottR: maybe you’re not a) cute enuf; or b) helpless-looking enuf. Also, you’re refutation is invalid because "rarely" does not mean "never". And even if an analogy doesn’t apply to your little universe it doesn’t mean it’s not valid.
what is a bagger? actually I can probably guess… its the poor mexican immigrant getting paid $1/hr to pack groceries into bags for lazy Americans :-)
Also keep up the footnote fun, it keeps stupid people from writing code since they spend all their time arguing about footnote symbols.
No complaints about footnote symbols here and I don’t even care about them to be honest.
But this is strange. I am using firefox and I see an asterix just fine. However when used together with the IE tab extension and I visit this place again with an IE view now, the asterix becomes a mail message icon.
Paully: Grocery stores still have to pay Mexican immigrants minimum wage. There were plenty of Mexicans working at the Wendy’s store I worked at before going into IT, and most of them were paid *more* than I was (They had been working at the store longer than I was).
As for baggers, they’re some random employee that could have been doing anything else. I’ve seen people that worked as cashiers the day before, managers, stockers, anyone will do the bagging. They can be of any gender and any race.
If you were intending to say *illegal* immagrants, illegals are usually hired to do yard work or construction work. Most major franchise companies won’t hire illegals because it would be a scandal if they were caught. Mom&Pop stores might, though.
Yes, I lived in southern California where country gas stations doubled as a hard labor recruiting offices (lots of illegals hanging out, looking for work).
Raymond: Love the footnote symbols.