I think it’s safe to say that you’re familiar with this unabiding dude. Years ago I wrote a program to suppress Automatic Update’s┬árepeated prompting by setting the window’s state to hidden. This simple parlor trick is easily the most well received program I’ve ever written. Ubiquitous loathing equals opportunity.

There are more official ways to silence the nagging such as stopping the Automatic Update service but they require admin rights so that’s likely a non-starter if you’re at work. This low-brow, low-impact trick requires no special access and is a great compromise: you get prompted when you need to restart, which is good, and you can choose to dismiss the prompt without further prompting, which is also good. And if you do want to see the prompt again, just click Automatic Update’s icon in the system tray and it will return.

So let’s take a look at this unadulterated pinnacle of twenty first century technology:

// HideAutoUpdate by Chris Benshoof
//  the best flipping thing i'll ever write
#include <windows.h>
#include <tchar.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
    HWND dialog = FindWindow(WC_DIALOG, _T("Automatic Updates"));
    if (IsWindowVisible(dialog))
    {
        ShowWindow(dialog, SW_HIDE);
    }
    return 0;
}

Yup, a life well spent. There’s really not much to elaborate on, it’s easy to write self-documenting code when your entire program is three function calls. The reason this prevents the dialog from coming back is that as far as Automatic Update is concerned the dialog is already being shown. It’s only when the dialog is closed or minimized that Automatic Update considers it gone and in need of eventual resurrection. Automatic Update never considers the possibility that the dialog is hidden (why should it?) and so placation ensues. If it weren’t so thoroughly disrespectful to the civil rights movement to compare myself with a leader of nonviolent resistance, I would totally compare myself to a leader of nonviolent resistance.

I write a lot of programs like this, little ones that wrap around or make use of just a couple API calls. It’s kind of a stretch to even call them programs. They’d be scripts if I didn’t have to bust out a damn C++ compiler to do anything interesting in Windows. S’all in the game, yo. If I have to write some small programs then I’ll write some small programs. Fact is, I kinda like it. But if I have to compile some small trivial programs… well then I expect the resulting program files to be small, because they’re trivial. Who wouldn’t? Errrbody, apparently.

Next time we’ll get completely distracted by the┬áissue of executable size in a modern Windows world without getting distracted by its questionable relevance. Until then, enjoy all 1.5kb of HideAutoUpdate.exe!

HideAutoUpdate.exe