title: Why am I getting error code 87 (Invalid parameter) from RegisterClassEx?
body: <p>Here's the code</p>
  
  <pre><code>#include &lt;windows.h&gt;
  const wchar_t g_szClassName[] = L"myWindowClass";
  // Step 4: the Window Procedure
  LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
  {/*...*/
      return 0;
  }
  int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
      LPSTR lpCmdLine, int nCmdShow)
  {
      WNDCLASSEX wc;
      HWND hwnd;
      MSG Msg;
      //Step 1: Registering the Window Class
      wc.cbSize        = sizeof(WNDCLASSEX);
      wc.lpfnWndProc   = WndProc;
      wc.cbClsExtra    = 0;
      wc.cbWndExtra    = 0;
      wc.hInstance     = hInstance;
      wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
      wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
      wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
      wc.lpszMenuName  = NULL;
      wc.lpszClassName = g_szClassName;
      wc.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);
      if(!RegisterClassEx(&amp;wc))
      {
          MessageBox(NULL, L"Window Registration Failed!", L"Error!",
          MB_ICONEXCLAMATION | MB_OK);
      return 0;
      }
      // Step 2: Creating the Window...
      return Msg.wParam;
  }
  </code></pre>
  
  <p>This code is straight from Forgers Win32 Tutorial (with <code>L""</code> and wchar_t where needed). Yet I can't make it work on WinXP SP3 x86 and VC2008Express SP1.</p>