title: SetLayeredWindowAttributes to make CEF transparent not working on Windows XP
body: <p>I use <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms633540%28v=vs.85%29.aspx" rel="nofollow">SetLayeredWindowAttributes</a> with LWA_COLORKEY to replace a color (#ff00ff) with transparency, in order to achieve transparent background in the <a href="http://code.google.com/p/chromiumembedded/" rel="nofollow">CEF1</a> example.</p>
  
  <p>It works well on 7/Vista.<br>
  On Windows XP, the function succeeds, but the color remains opaque.</p>
  
  <p>My code to create the main window:</p>
  
  <pre><code>BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) {
    HWND hWnd;
    hInst = hInstance;
    hWnd = CreateWindowEx(WS_EX_LAYERED | WS_EX_TOPMOST | WS_EX_COMPOSITED, szWindowClass, szTitle,
                   WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_VISIBLE, CW_USEDEFAULT, 0,
                   CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
  </code></pre>
  
  <p>WndProc for the main window:</p>
  
  <pre><code>switch (message) {
  case WM_CREATE: {
    ...
    info.SetTransparentPainting(TRUE);
    info.SetAsChild(hWnd, rect);
  
    // Create the new child browser window
    CefBrowser::CreateBrowser(info,
        static_cast&lt;CefRefPtr&lt;CefClient&gt; &gt;(g_handler),
        url_to_pageWithMagentaBackground, settings);
  
    SetLayeredWindowAttributes(hWnd, RGB(0xff, 0x00, 0xff), 0xff, LWA_COLORKEY);
  </code></pre>
  
  <p>Html displayed:</p>
  
  <pre><code>&lt;style type="text/css"&gt;html { background: #ff00ff; }&lt;/style&gt;
  </code></pre>
  
  <p>Note these points:  </p>
  
  <ul>
  <li><p>It does work on XP with LWA_ALPHA (makes whole window semi-transparent),
  but not with LWA_COLORKEY    </p></li>
  <li><p>When I connect to the XP through Remote Desktop, I do see the transparency as expected!</p></li>
  </ul>
  
  <p>Can someone explain this please?</p>