winapi - SetLayeredWindowAttributes to make CEF transparent not working on Windows XP -
i use setlayeredwindowattributes lwa_colorkey replace color (#ff00ff) transparency, in order achieve transparent background in cef1 example.
it works on 7/vista.
on windows xp, function succeeds, color remains opaque.
my code create main window:
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);
wndproc main window:
switch (message) { case wm_create: { ... info.settransparentpainting(true); info.setaschild(hwnd, rect); // create new child browser window cefbrowser::createbrowser(info, static_cast<cefrefptr<cefclient> >(g_handler), url_to_pagewithmagentabackground, settings); setlayeredwindowattributes(hwnd, rgb(0xff, 0x00, 0xff), 0xff, lwa_colorkey);
html displayed:
<style type="text/css">html { background: #ff00ff; }</style>
note these points:
it work on xp lwa_alpha (makes whole window semi-transparent), not lwa_colorkey
when connect xp through remote desktop, see transparency expected!
can explain please?
Comments
Post a Comment