Using the free version of Microsoft Visual C++ 2008 Express Edition, I was able to construct this tiny utility to use in my BAT command files, so that its annoying DOS window would fade away into oblivion when double-clicking it from Windows.

// hideme.cpp
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>

int _tmain(int argc, _TCHAR* argv[])
{
  HWND currenthwnd, hwnd;
  hwnd = NULL;
  currenthwnd = GetForegroundWindow();
  if (currenthwnd != hwnd) {
    hwnd = currenthwnd;
    if (hwnd)
      ShowWindow(hwnd, SW_HIDE);
  }
  return 0;
}

Funny, after writing and using this hideme.exe utility, I got annoyed that there was no obvious way to associate a nice icon to it!  So after a lot of digging, I discovered that you can add a Resource File to the C++ project, but you must edit it by hand — seems that it was deliberately removed.  Here’s a nice working version of hideme.rc:

#include <windows.h>

ID1_ICON ICON "hideme.ico"

LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
VS_VERSION_INFO    VERSIONINFO
FILEVERSION      2008,10,5,1
PRODUCTVERSION   2008,0,0,1
//  VS_FFI_FILEFLAGSMASK
    FILEFLAGSMASK    0x3fL
#ifdef _DEBUG
//  VS_FF_DEBUG|VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE
    FILEFLAGS        0x1L
#else
//  final version
    FILEFLAGS        0x0L
#endif
FILEOS           VOS_NT_WINDOWS32
FILETYPE         VFT_APP
FILESUBTYPE      VFT2_UNKNOWN // not used
{
  BLOCK "StringFileInfo"
  {
    //  Lang=US English, CharSet=Windows Multilingual
    BLOCK "040904E4"
    {
      VALUE "Build",            "October 2008\0"
      VALUE "Comments",         "Hide the active window\0"
      VALUE "CompanyName",      "Robert Hurst\0"
      VALUE "Developer",        "Robert Hurst\0"
      VALUE "FileDescription",  "Hide the active window\0"
      VALUE "FileVersion",      "2008.10.5\0"
      VALUE "InternalName",     "HideMe\0"
      VALUE "LegalCopyright",   "(C) 2008 Robert Hurst\0"
      VALUE "LegalTrademarks",  "All rights reserved.\0"
      VALUE "OriginalFilename", "hideme.exe\0"
      VALUE "PrivateBuild",     "\0"
      VALUE "ProductName",      "HideMe\0"
      VALUE "ProductVersion",   "2008.1\0"
      VALUE "Publisher",        "Robert Hurst\0"
      VALUE "SpecialBuild",     "\0"
      VALUE "Support",          "http://robert.hurst-ri.us\0"
      VALUE "Users",            "Geeks and nerds\0"
    } // BLOCK "040904E4"
  } // BLOCK "StringFileInfo"
  BLOCK "VarFileInfo"
  {
    VALUE "Translation", 0x409, 1252 // 1252 = 0x04E4
  } // BLOCK "VarFileInfo"
}

A compiled binary is available here.