Date: | June 21, 2006 / year-entry #207 |
Tags: | code |
Orig Link: | https://blogs.msdn.microsoft.com/oldnewthing/20060621-17/?p=30793 |
Comments: | 11 |
Summary: | You too can use your psychic powers to debug the following problem: We have a problem with opening documents with our application by double-clicking them in Explorer. What's really strange is that if we connect a debugger to Explorer and set a breakpoint on kernel32!CreateProcessW, then wait a moment after CreateProcess returns, then hit 'g',... |
You too can use your psychic powers to debug the following problem:
If you've been reading carefully and paid attention to the explanation of how document launching via DDE works, then you already know what the problem is.
Recall that launching documents via DDE is done by first
looking for a DDE server and if none is found, launching
a server manually and trying again.
The command line above was clearly registered as the
Clearly, something is going wrong when Explorer attempts the second DDE conversation to open the document. The fact that making Explorer wait a few seconds fixes the problem makes the cause obvious: The DDE server is being slow to get itself initialized and listening. Explorer launches the server and tries to talk to it, but the server is not yet ready and therefore doesn't respond to the DDE initiate. But how do you fix this?
The shell assumes that a DDE server is ready to accept connections
when it goes input idle.
Once Moral of the story: If you're going to act as a DDE server, make sure you do so before your primary thread starts pumping messages. Otherwise you have a race condition between your application startup and the shell trying to talk to it. |
Comments (11)
Comments are closed. |
<i>This article was written from a programmer’s point of view, not an end user’s point of view. As a programmer, you should be accustomed to looking at the bigger picture to see how something could have happened. As for the error message, what would you have preferred? Something ultra-geeky like "The program responsible for opening this document was run, but it did not accept the document"? That just makes people say, "Computers are hard to use." -Raymond</i>
Raymond, the problem people have with this message is that what Windows is saying at the moment is just confusing. The file ‘abc.lit’ clearly exists, the user will say, it’s right here. Why can’t Windows find it?
Windows should definitely distinguish the case that the document can’t be found and its associated application can’t. Perhaps "Windows was unable to open ‘abc.lit’ because of an application error." or something similar. It doesn’t have to be complicated, it just has to represent the truth of what happened, rather than the current message which is blatantly misleading and is likely to have the user barking up the wrong tree for ages trying to figure out what’s wrong.
This is one of the problems a lot of people have with Windows: it spends too much time trying to protect the user and not enough making sure they have enough information to fix whatever’s wrong.
Error messages that say one thing’s wrong when it’s actually something entirely different that’s wrong don’t help anyone. It would be as useful to pop up a box that says, "I’m sorry, I can’t do that Dave" or something.
<i>True. Windows’s instruction to a double-clicker to check their typing is both sucky and insulting, and the reason isn’t because suckage is the same as insulting (they’re not the same), the reason is simply because that instruction is both. Some of us get used to these insults when we’ve seen them for 10 years, but that doesn’t mean that new users will be less insulted by them.</i>
I’m reminded of my work colleague who, once every couple of weeks or so, yells at the top of his voice, "No! I didn’t forget my ****ing password!". The XP "Welcome" screen isn’t just insulting, it’s condescending.
Thursday, June 22, 2006 1:11 PM by alexandre.r.
> What step should I follow, as a user, to fix
> this error?
Complain to the maker of the application?
Historically some makers occasionally fixed bugs when informed about them, though that’s rare today.
Some makers still don’t require upfront fees before letting victims complain about bugs.
Maybe the user can also discover that in the future they wish to buy a competing application instead of the buggy application. If the buggy application doesn’t come from a monopoly, they might even have the power to follow through on this wish.
Maybe eventually people will stop blaming Windows when the bug belongs to an application. There’s a long row to hoe before this message can sink in, but every journey starts with a single step. Hypothetically this could be such a step.
I totally agree with Norman. As long as bugs aren’t revealed correctly, users don’t learn who’s really at fault and vendors don’t feel they need to fix things.
Raymond, I’ve heard programmers argue against fixing something because they think the user will blame Windows! I can’t tell you how many times I’ve submitted website bug reports, only to be told by a 1st-level tech support weenie that I should upgrade IE, or update Windows, or go read some MS KB. Even after I tell them I’ve done all those things!
Remember that long Samba bug discussion… make the users pissed at Linksys or Netgear or whoever sold them the box – that’s the only way to make the vendor fix things.
DriverDude wrote
I totally agree with Norman. As long as bugs aren’t revealed correctly, users don’t learn who’s really at fault and vendors don’t feel they need to fix things.
Raymond, I’ve heard programmers argue against fixing something because they think the user will blame Windows! I can’t tell you how many times I’ve submitted website bug reports, only to be told by a 1st-level tech support weenie that I should upgrade IE, or update Windows, or go read some MS KB. Even after I tell them I’ve done all those things!
Remember that long Samba bug discussion… make the users pissed at Linksys or Netgear or whoever sold them the box – that’s the only way to make the vendor fix things.
I reply:
The KB article is more often never read before than already read, however.
And yes, the NAS manufactor is the only that can be blamed for not updating Samba.