Some suggestion box topics turn into daily entries. Others deserve just a sentence or two. Here are the short answers.
- Can you shed some light on RPC_E_CANTCALLOUT_ININPUTSYNCCALL?
- This one is kind of bizarre, because the person who asked the question linked to the answer!
- What form do application hacks usually take in Windows?
- They take many forms, depending on the situation, but checking a window caption is definitely ill-advised, since that creates the opportunity both for false positives (what if an unrelated program happens to have the same caption?) and false negatives (will the German version of the program have the same caption?). On a related note, Chris Jackson writes about the shim proces itself, which you might find interesting.
- Why doesn't PathFileExists support UNCs?
-
Actually, it does. What the documentation is trying to say is that it doesn't work is for things like \\server
. That will return FALSE
even if the server exists. (I've sent a clarification to the documentation team. Who knows whether they'll accept it.)
- A series of remarks (but no question) about Kennedy-Western University
-
This wasn't a topic suggestion, just somebody who wanted to take what I said and argue against it with made-up facts. "I to enjoy people that display their ignorance in frount of all of us." You can get a mirror at Ikea for just a few dollars.
- How do I put focus on a window without raising it?
-
One of the window manager's design principles is that the active window comes to the top.
- Some really long list of complaints
-
Um, I didn't see a topic suggestion in there. (Not that I really had much incentive to look hard for one.) It looks like just a bunch of ranting.
- On tooltips that get stuck behind other windows (Question was duplicated. How hard is it to search the Suggestion Box page to see if somebody already asked your question?)
-
If you set your owner correctly and don't play weird games, everything will be just fine. The problem is that the taskbar has to play weird games because of all the other applications that play even weirder games. When you play weird games, things get weird.
- Is there a way to send input other than SendInput?
-
No. You can try to fake it but you're going to run into problems.
- Why doesn't AltGr+Del act like Ctrl+Alt+Del?
-
I don't know but I can guess, and so can you. Hint: Component layering. Low-level components vs. higher-level components.
- Why do some MSDN samples use the goto statement?
-
That's a coding style issue. Believe it or not, different people have different styles, and there is no mandated "MSDN coding style". Some people are more averse to the goto statement than others.
- A question putatively about
WS_TABSTOP
-
Somthing is horribly wrong with your program design if each edit control in your dialog has its own message pump! Fix that first, then the tab stop issue should fix itself.
- Why can't you call
SetFocus()
on a window in another thread?
-
I covered this in my PDC 2005 talk.
Another category is people who ask a question I've already answered or ask a question that has already been asked.
- Why doesn't the taskbar have my pet feature? Again. And again. And again. Is it so hard to search on the very page you're posting your suggestion to?
- I already discussed the feature process. I happen to know the person responsible for Start menu and taskbar features in Windows Vista. The list of design changes and feature requests was over 200 items long and obviously not all of them could be addressed. (And that list was just of the design changes and feature requests that overcame the starting point of minus 100 points.)
- What are these mystery folders in my Program Files directory?
-
Answer.
- What is the deal with the time zone map?
-
This question was asked over two years after I answered it. What's particularly baffling about this one is that the time zone article is one of the most frequently-linked entries I've written! How could the person not have found it?
- Is there way to get the current full path from an Explorer window?
-
I answered this over a year previously and then again three months before the suggestion was posted.
- Why do some files come up strange in Notepad?
-
I answered this over two years previously.
- Why does the resource compiler complain about strings longer than 255 characters?
-
I answered this over two years previously.
And then there are the people who ask questions on things that I explicitly listed as topics I am not inclined to cover.
And then there are the suggestions that are so wildly off topic I don't even know why they bothered to ask me, such as this person who wants me to discuss a VB6 language feature and another who wants me to discuss non-short-circuit evaluation in Visual Basic. I have no idea why they chose me to ask these questions. In my experience, VB doesn't even stand for Visual Basic! Another person asked a long, rambling question about Unicode IME that I got tired of reading.
I'm kind of baffled by this comment asking how to post a comment.
Other topics I am unlikely to cover are personal biography since that just leads to WikiStalking.
Don't ask the same question to multiple people. It duplicates effort. (Another example.)
And then there are people who just like to natter on about their uneventful lives, yammering repetitively about how nothing is going on and that they are bored. Hey, don't take your boredom out on me. I'm trying to get some work done here. If you want to chatter, go start your own blog.
Generic viagra credit cards ringtones.
The ideal length for a topic suggestion is a single paragraph between two to four sentences. If it's too short, there isn't enough context. If it's too long, I will lose interest and not bother reading the suggestion.
That's all the short answers for this year. (You may have noticed that I've generally been using Mondays to following up on topics posted to the suggestion box or in blog comments.)
Wow, when you complain about people’s suggestions, you do it right.
Fortunately, my suggestion question wasn’t shot down by any of these examples, so I’m still hopeful that you’ll (eventually) answer it.
Raymond, any chance you could open Suggestion Box 4?
I’ve got some questions, of a sentence or two in size, to do with Shell_NotifyIcon, that I think you’d be able to delve into more deeply than I could…
Wow, thanks for answering my question on focusing w/o raising (I must have been frustrated at the time.. making so many spelling errors).
FWIW, the ability to focus without raising has been in the window manager for years though. TweakUI allows you to turn on the focus-follows-mouse option and it does this by flipping a bit in the registry (Control PanelDesktopUserPreferencesMask). Admittedly, just because the window manager is able to do something doesn’t mean a lowly application should, but clearly the ability is there.
Your answer confirms that I didn’t miss some documented way of accomplishing this though. Good stuff.
rlipscombe — As explained here:
http://blogs.msdn.com/oldnewthing/archive/2007/07/10/3799014.aspx#3800932
the current suggestion box backlog will last at least into 2010. That’s why it isn’t open now: suggestions were getting added so fast that had it stayed open, Raymond would have just kept falling farther and farther behind.
Not sure what sort of questions might arise from the Shell_NotifyIcon API that wouldn’t be covered by a combination of "NEVER do that from a service!" and the documentation, but hey, whatever.
Wow, what was going on with the RuleZ023 posts? Some kind of automated spam I guess. But I can’t imagine for what purpose.
Fair enough, Raymond. The bit flip is the result of calling SystemParametersInfo() with SPI_SETACTIVEWINDOWTRACKING. Regardless, my point was the window manager still has this (apparently documented) ability.
Today’s article was really long; did you ever get tired of writing it?
Then one more offtopic:
why the heck MSDN is removing Windows 95/98/Me references from API declarations?!
Something to consider:
http://www.google.com/search?hl=en&safe=off&q=your+question+here+site%3Ablogs.msdn.com%2Foldnewthing%2F&btnG=Search&meta=
MSDN examples probably use gotos for the purpose that they are most useful: Cleaning up after an exception.
C# has try/finally for this. C++ doesn’t, but that’s no reason not to use the same structure. Better than risking a memory leak.
Gazpacho, C++ doesn’t have try/finally because it doesn’t need try/finally. Also, MSDN examples, with respect to the Win32 API, are written in C.
"Why doesn’t AltGr+Del act like Ctrl+Alt+Del?"
IBM programmer David Bradley arbitrarily decided in 1981 to make it that way.
Changing it now would break programs that happen to use AltGr+Del for their own purposes.
Johnny, you’re already getting pretty far afield. I don’t think this is a question of what features a language should or shouldn’t have, nor what language most of the examples are written in (the question said C and C++). It’s about why they use goto.
No, C++ does not "need" try/finally, but Windows programs generally need to allocate resources temporarily and make sure they are always properly released. Many MSDN examples use goto for this. The resulting code structure differs only superficially from C# code that uses try/finally for the same purpose.
There’s a question at http://blogs.msdn.com/oldnewthing/pages/407234.aspx#608186 where the answer is quite simple: Lying through their teeth. :p
Hey Triangle: Would you mind telling that to Nawak, Erwien Saputra, Patrick, and sfilippov? Thank-you.
foxyshadis: That’s not (necessarily) the case; it probably means the app is large address aware (see, for example: http://www.anandtech.com/gadgets/showdoc.aspx?i=3034&p=5)
…or that it might be a .NET 2.0 application, which it is according to the FAQ.
The guy commenting on the Access bug wasn’t complaining. He was merely suggesting it was an amusing failure that you might get some light relief out of mentioning.
He had of course no knowledge of the famous Photo Draw bug, when Photo Draw would not install if you had an odd number of fonts on the machine. Yep, didn’t matter if it was one or 497, it wouldn’t install unless there was an even number of fonts in the folder.
The Access bug does touch tangentially on another point. Why are software error messages so totally out. The Access 97 bug, where it wouldn’t install if you had a particular font (that came with Publisher I believe) on the machine, gave the error message that you didn’t have a license to install Access on the machine, which led to some unpleasant scenes when I was accused of installing pirated software.
(Actually, maybe error messages like this are written on purpose. I still remember a colleague who returned to the UK from Saudi and went off and while installing one of the pirate CDs he had come back with received about an illegal operation causing the machine to shut down. He immediately went off and spent a few hundred pounds on legal copies before the boys in blue arrived at the door to arrest him!).
This is *just a guess*, but I’m betting people are asking you questions you’ve already answered because the search on your blog* returns garbage most the time.
Besides that, I almost choked to death laughing while reading the last paragraph.
*On firefox 1.5.0.12 searching from blogs.msdn.com it fails with a Javascript error about __doPostBack being undefined.
I don’t know what to make of the Access 97 bug, but The PhotoDraw installation bug sounds like a case of someone allocating an array one item too short. It’s an embarrassing bug that should have been caught in testing, but it (like other bugs) has a non-devious explanation.
RuleZ023 is depressed and should be seeking help.
Also:
"Why are software error messages so totally out."
Because developers focus their efforts on making the software work, not making it fail beautifully.
"Why can’t you call SetFocus() on a window in another thread?
I covered this in my PDC 2005 talk.
Another category is people who ask a question I’ve already answered or ask a question that has already been asked."
So basically, before asking a question, we are not only supposed to have read every article ever posted on this blog, but also watched/listened to/read/etc every other thing that Raymond has ever published/said/etc!?
Seriously Raymond maybe it is slightly annoying if people keep asking questions that have been answered, but pointing people in the right direction is fine, there is no need to be so angry about it. Chill out!
foxyshadis: maybe the program uses AWE?
Microsoft does this in TweakUI – that is, there is a setting there to activate a window without raising it to the top; why I cannot do the same?
In TweakUI there are two checkboxes: "activation follows mouse" and "raise active window to top". "Active window tracking" manages only one of these two.
I apologize for not reading the manual.
The proper action is called
SPI_SETACTIVEWNDTRKZORDER
In context of this discussion this proves that it IS possible to activate a window without raising it to the top. What if I want to do that, but do not want to use "active window tracking"?
Scorpion007 and Sven: You’re wrong, your comments have nothing to do with the original question, and you’re obviously trying to score internet points.
Triangle: You said "On firefox 1.5.0.12 searching from blogs.msdn.com it fails with a Javascript error about __doPostBack being undefined."
Try using IE then; it searches just fine. Maybe Firefox is broken.
Enough of that GOTO and exception off-topic!
Use it or not, it is up to you, we don’t have to know about it.
C(++) *does* have try/finally: it’s called Structured Exception Handling.
It’s implemented using the syntax __try/__finally. There’s also __except.
It’s supported by MSVC, but not sure about other compilers.
(C++ obviously supports standard exceptions using try, catch, but I believe they are implemented internally using Win32 SEH, see Richter’s book).
Fred: You got it backwards. Raymond’s "Another category" message refers to the six questions *below* the message, not the one answer above it.
Scorpion007: SEH is a Windows feature that MSVC exposes through the __try/__except/__finally keywords. Other compilers targeting Windows might support it (not sure), compilers that don’t target Windows most certainly will not. SEH is *not* in any way part of ISO standard C++.
Gazpacho: goto is not a valid replacement for try/finally, because it is not exception safe. The cleanup code in the finally block gets run regardless of how the try block is exitted, whether that be regular flow, a return statement, or an exception. Using goto will not cover the "early return" scenario and most certainly also not the exception scenario.
However, C++ has a proper mechanism to deal with this, where whatever resource you need to clean up is wrapped in a class which is created on the stack. In this case, the class’s destructor is responsible for the cleanup. Since exceptions in C++ do proper stack unwinding, this destructor will always get called, regardless of how the function exits. This principle is called Resource Acquisition Is Initialization (RAII). It’s a little more work than try/finally (and is probably overkill for a code sample on MSDN), but it works very well. See also this article I wrote on the topic a while back: http://www.ookii.org/post/tryfinally_vs_raii.aspx
—"but it (like other bugs) has a non-devious explanation."—
Microsoft are not guilty on this one. The bug was there before they bought Photodraw, and MS actually fixed it.
andg — You can do the same, but you’d better give the user some way to undo the change. Call SystemParametersInfo with the setting SPI_SETACTIVEWINDOWTRACKING and the appropriate value. That’s all that TweakUI does (or seems to do).
Note that TweakUI does *NOT* set each window up to get activation without being raised, individually. It’s a system-level setting; either it’s off or on for each individual system. (Or each desktop, I’m not exactly sure. It’s way less granular than "per window", in any case.)
That’s why you’d better give the user the opportunity to turn it off; if your program turns it on without notification and without the opportunity to cancel (and without any other way to turn it off again), then your program is being antisocial. Or worse.
Gazpacho: score Internet points? I have no idea what that even means.
The original question was why MSDN uses goto in some samples. Raymond suggested that it was a matter of style, which is fine with me (I have no strong feelings towards goto either way). You suggested that they used it as an alternative to try/finally, which is not fine, because the semantics of try/finally cannot be duplicated with goto in the context of exceptions.
My explanation of a alternate method to do cleanup in C++ that does have the same semantics as try/finally was arguably off-topic, but I didn’t realize that was a crime these days.
"So basically, before asking a question, we are not only supposed to have read every article ever posted on this blog, but also watched/listened to/read/etc every other thing that Raymond has ever published/said/etc!?"
Er, yes? (Seriously, it *is* reasonable to use the available search facilities to see if it has come up before. There’s a search on this blog and there’s Google.)
Raymond: thanks for giving these lazy suggestions a good kicking. I feel much better for reading today’s blog.
Thanks for anwering (all?) questions!
Shame about the Outlook sound. I thought it might tickle Raymond’s curiosity. Ho hum.
I suppose you have to experience the culture shock of hearing a sound that happens at your desk in the UK, in a hot, crowded railway station in a faraway tropical country.