Browse by Tags

Tagged Content List
  • Blog Post: It’s a bad idea to have a TEMP environment variable longer than about 130 characters

    I've been working with the Win32 API for almost 20 years - literally since the very first Win32 APIs were written. Even after all that time, I'm occasionally surprised by the API behavior. Earlier today I was investigating a build break that took out one of our partner build labs. Eventually I root...
  • Blog Post: Building a flicker free volume control

    When we shipped Windows Vista, one of the really annoying UI annoyances with the volume control was that whenever you resized it, it would flicker.  To be more specific, the right side of the control would flicker – the rest didn’t flicker (which was rather strange).   Between the Win7 PDC...
  • Blog Post: What’s the difference between GetTickCount and timeGetTime?

    I’ve always believed that the most frequently used multimedia API in winmm.dll was the PlaySound API.  However I recently was working with the results of some static analysis tools that were run on the Windows 7 codebase and I realized that in fact the most commonly used multimedia API (in terms...
  • Blog Post: Delay Load is not a good way to check for functionality

    On my previous post , Koro made the following comment : “Don't ever check windows versions.  Instead check for functionality being present or not." You can't always do that. Do I want to add a __try/__except to catch delay-load exceptions around every UxTheme call or just do: g_bTheme=(g_bWinNT&&...
  • Blog Post: Fixing an accessibility bug with the trackbar common control

    The trackbar common control is a strange beast. The trackbar can be oriented either horizontally or vertically. On LTR language machines, when the trackbar is horizontal, it works much as you’d expect it to: The minimum value of the trackbar is on the left, the maximum value is on the right (it’s...
  • Blog Post: Fixing a customer problem: “No Audio Device is Installed” when launching sndvol on Windows Vista

    Yesterday someone forwarded me an email from one of our DirectShow MVPs – he was having problems playing audio on his Windows Vista machine.   Fortunately David (the MVP) had done most of the diagnostic work – the symptoms he saw were that he was receiving a “No Audio Device is Installed” error...
  • Blog Post: What really happens when you shutdown Windows?

    About a year or so ago, I wrote a post that talked about the Windows shutdown experience.   A couple of the people reading the post asked for more details, and it turns out that the performance folks have just issued this paper which describes (in great detail) what happens during system boot and...
  • Blog Post: The common control library sometimes sends an NMCUSTOMDRAW message for the NM_CUSTOMDRAW notification.

    I just fixed a bug in our UI that was caused by a misunderstanding of the API contract for the NM_CUSTOMDRAW handler for some of the common controls. On of October 3rd, 2008 The common control documentation for the NM_CUSTOMDRAW message says: lpNMCustomDraw A pointer to a custom draw-related structure...
  • Blog Post: DrawThemeText doesn’t really support the DT_CALCRECT format value

    I just noticed this while working on a bug fix. We have some code that attempts to determine the size of a piece of text by calling DrawThemeText with the DT_CALCRECT format value. According to this page (as of 9/30/2008) the DT_CALCRECT option determines the width and height of the display rectangle...
  • Blog Post: Why specify SND_NODEFAULT when calling PlaySound?

    Because the alternative is often much worse.   Several months ago, I got a bug report that if you launched mmsys.cpl then set the “Select” sound to a value, then cleared the sound, the reporters application would ding whenever you moved around their tree control. I dug into the problem a bit and...
  • Blog Post: Why call PlaySound(NULL, NULL, SND_NODEFAULT)?

    Someone just wandered over to my office and he had noticed the following pattern in his code: PlaySound(NULL, NULL, SND_NODEFAULT); PlaySound( ".Default" , NULL, SND_SYSTEM | SND_ASYNC | SND_NODEFAULT); He was wondering why on earth the code would do that call to PlaySound (NULL). ...
  • Blog Post: Anatomy of a Heisenbug

    I just spent a half an hour debugging a heisenbug and thought I’d pass on what was happening.   I was running my unit tests for one of my features and they were reliably failing.  Unfortunately the instant I ran the test case under the debugger, the problem went away.  Problems that disappear...
  • Blog Post: Gotchas associated with using WM_PRINTCLIENT…

    Yesterday I mentioned WM_PRINTCLIENT and how awesome it is when trying to strictly control the drawing of your application. Part of the reason it took over a week to change the drawing model is that there are a number of serious gotcha’s associated with using WM_PRINTCLIENT and controlling your own drawing...
  • Blog Post: Larry’s new favorite windows message – WM_PRINTCLIENT

    As I’ve mentioned before, I’ve been fuddling around doing UI programming recently – it’s a bit different from my usual work deep in the bowels of the <insert whatever subsystem Larry happens to be working on (redirector, audio stack, POP3 server, whatever)>.   I’ve been having a great deal...
  • Blog Post: The SS_PATHELLIPSIS, SS_ENDELLIPSIS and SS_WORDELLIPSIS styles force static controls to disable word wrap.

    I didn’t find this in the documentation for the static standard window so I figured I’d put it out in my blog in the hopes that someone else won’t get stuck on this problem. The Windows “static” control has a number of styles that control how the control draws text. They can be extremely useful when...
  • Blog Post: What’s wrong with this code, Part 22 – the answers

    The other day, I wrote about measuring the dimensions of a piece of text using the DrawText API . My code worked just great when I initially tested it (obviously it’s a part of a larger chunk of code that does more complicated work).  The problem showed up when I started testing it on a machine...
  • Blog Post: What’s wrong with this code, part 22 – Drawing Text…

    Recently I’ve been working on something that I’ve never done before in my almost 24 years at Microsoft.    For the past 23ish years, I’ve been a plumber – all the work I’ve done has been under the covers.  But for the next version of Windows, I decided to stretch my boundaries a bit and...
  • Blog Post: Casting from one interface to another...

    A co-worker came by to ask what he thought was a coding "style" question that turned into a correctness issue, and I thought I'd share it. Someone had defined two COM interfaces: interface IFoo : IUnknown { HRESULT FooMethod1(); HRESULT FooMethod2(); } They also had a factory interface...
  • Blog Post: The Shell used to get all the cool APIs :)

    After I posted my article on the SHAutoComplete , I mentioned it to one of my co-workers. His response "I'm not surprised - The shell gets all the cool APIs". And they do. For instance, my "new favorite" Win32 API : RegGetValue began it's life as the SHRegGetValue function. But increasingly, many of...
  • Blog Post: Adding AutoComplete to your edit controls

    For whatever reason, most of the toy applications I tend to write seem to end up being dialog based applications. I'm not 100% sure why, it probably has to do with the fact that the dialog box editor makes it really easy to drop controls on a page. One of the things I often have to do is to specify a...
  • Blog Post: "Memory Leak" when using the Vista Audio API notification routines

    We recently got an internal report from someone using the internal audio notification APIs that they were leaking memory and they wanted to help from us debugging the problem. I took a look and discovered that the problem was a circular reference that was created when they called: CFoo::Initialize()...
  • Blog Post: The Windows command line is just a string...

    Yesterday, Richard Gemmell left the following comment on my blog (I've trimmed to the critical part): I was referring to the way that IE can be tricked into calling the Firefox command line with multiple parameters instead of the single parameter registered with the URL handler. I saw this comment and...
  • Blog Post: Applet Mitigations - Services.

    As a senior developer at Microsoft, you often find yourself participating on a number of v-teams. One of the v-teams I'm on is responsible for approving new services added to Windows. As I've mentioned before, I'm a nutcase about stuff running on my machines, and services are absolutely among the things...
  • Blog Post: Applet Mitigations

    As I've mentioned , applets can be a plague on your system. The annoying thing is that it's possible to write applets that aren't so horrible. And most of the mitigations are really just common sense ideas - there's nothing spectacularly complicated in any of them. As with the earlier posts in this...
  • Blog Post: It's my computer, dagnabbit, not yours!

    I've been wanting to write this one for a while, but continually got sidetracked, but there's no time like the present... Many others (I'm too lazy to chase down references) have commented on the phenomenon known as " bloatware " (also known as "craplets" or " shovelware "). I'm not going to talk...
Page 1 of 6 (132 items) 12345»