The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
Email tip: When asking for help with a problem, also mention what you've already tried
When you ask a question, you should also mention what steps you've already taken when attempting to solve it on your own. First of all, it saves the people who decide to help you with your problem from exploring lines of investigation which you've already tried (and which you know don't work). "I tried setting the timeout to 60 seconds before issuing the call, but it still failed with the error ." Second, it cuts down on noise on the discussion list. — Try setting the timeout to a higher value. "I already tried that; it didn't work." Third, it demonstrates that you cared enough about the problem to try...
Email tip: When you say that something didn't work, you have to say how it didn't work
I illustrate this point with an imaginary conversation, inspired by actual ones I've seen (and, occasionally, been a frustrated party to). From: X I want to do ABC, but I don't have a DEF. Anybody know of a workaround? Somebody has an idea: From: Y Try mounting this ISO file into a virtual machine and trying the ABC from there. Unfortunately, it didn't work: From: X I tried that, but it didn't work. Any other ideas? When somebody suggests a troubleshooting step or a workaround, but when you try it and it doesn't work, you need to say how it didn't work. The person who made the suggestion had...
The difference between your job and your hobby
There was an internal discussion about what Microsoft employees should be doing that do not directly relate to their job responsibilities, such as what text editor programmers should be using to write and edit code. Should anybody who uses a programming editor other than Visual Studio be branded a traitor? How about somebody who prefers a smartphone made by a certain Cupertino company? (And for some reason, this discussion took place on the Microsoft bloggers mailing list, because many people consider it a mailing list whose members are bloggers, as opposed to a mailing list for discussing blogging. I happen to...
Why does the wireless connection dialog ask for your password twice?
Martin wonders why the wireless networking dialog asks you to type your password twice when connecting to an existing network. Yeah, that bothers me too, and I don't know why either. But while we're on the topic of wireless networking, I thought I'd share a little program that is just as useless as my answer above. (If other people get to hijack the topic, then I want to also.) Back in the early days of Windows XP, I found that my wireless networking adapter would constantly disconnect and reconnect. I never figured out why, but I did have a theory. (Theory: The wireless zero configuration service sa...
The mysterious stock bitmap: There's no way to summon it, but it shows up in various places
A number of stock GDI objects are made available by the function, but one stock GDI object that is mysteriously missing is the stock bitmap. You can't summon the stock bitmap, but it manages to show up in various places, some of them perhaps unexpected. The stock bitmap is a monochrome 1×1 bitmap which GDI uses in various places where it has to produce a even though there really isn't any bitmap worth speaking of. In other words, it's used when GDI has to return something but would rather return nothing. When you create a memory DC, the current bitmap selected into it is the stock bitmap. When yo...
Why are there two values for NoDriveTypeAutoRun which disable Autoplay on drives of unknown type?
The Windows 2000 Resource Kit described the policy as consisting of a bitfield whose values are as follows: Hey, wait, two of the entries are the same. What's the difference between 0x1 (Disables Autoplay on drives of unknown type) and 0x80 (Disables Autoplay on drives of unknown type)? The values in the bitfield correspond to return values of the function: The value 0x1 corresponds to bit zero, which means that the function could not tell what type of drive it is. On the other hand, the value 0x80 does not correspond to any known return value of . It's reserved for future use. My guess as to ho...
When you create an object with constraints, you have to make sure everybody who uses the object understands those constraints
Here's a question that came from a customer. This particular example involves managed code, but don't let that distract you from the point of the exercise. I am trying to create a object using the constructor that takes an as input. In my .cs file, I create the native file handle using , as shown below. Then I create the object as so: The gets created fine. But when I try to do: it fails with the error "IO operation will not work. Most likely the file will become too long or the handle was not opened to support synchronous IO operations." Gives as (). The stack trace is as below. Can so...
It's a miracle humanity has survived this far, if reaction to the inability to make or receive a telephone call is to be believed
In one of the mailing lists devoted to chatting among people who work in a particular cluster of Microsoft office buildings, there was some discussion of the quality of mobile phone coverage in the parking garage. "I can't get a signal in any of the underground levels. This is intolerable!" — Here's an idea: Walk to ground level and make your call there. "But what if it's an emergency?" — Then run. (Or use one of the emergency phones.) Sometimes I wonder how humanity had managed to survive prior to the installation of mobile phone cell towers. Had these people been born just 30 years earlier, th...
How do I switch a window between normal and fullscreen?
Frederic Delhoume wants to know if there is a simple example of code that switches an application from windowed to fullscreen. He then included a code fragment that did some crazy things with parent windows and hiding and showing. You're making it way, way harder than it needs to be. Let's start with our scratch program and make these changes: To avoid getting into the intricacies of hotkeys and accelerators, I opted to toggle to fullscreen on a click. When the button goes up, we check whether we are currently in normal mode or fullscreen mode by sniffing at our window styles. If we are in normal mode, w...