Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows API
  4. Desktop Window Manager (DWM) problem

Desktop Window Manager (DWM) problem

Scheduled Pinned Locked Moved Windows API
helpsecurityquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Perspx
    wrote on last edited by
    #1

    I am using the Microsoft DWM (Desktop Window Manager), and I am using the DwmEnableBlurBehindWindow() function with the WS_EX_LAYERED style.. however, the window renders fine initially, but then when i move the window, it goes all weird and doesnt display the window properly and just displays the window icon and a garbled up title bar about 50pixels wide and 10pixels high.. heres the code: --- HRESULT EnableBlurBehindWindow(HWND window, bool enable = true, HRGN region = 0, bool transitionOnMaximized = false) { DWM_BLURBEHIND blurBehind = { 0 }; blurBehind.dwFlags = DWM_BB_ENABLE | DWM_BB_TRANSITIONONMAXIMIZED; blurBehind.fEnable = enable; blurBehind.fTransitionOnMaximized = transitionOnMaximized; if (enable && 0 != region) { blurBehind.dwFlags |= DWM_BB_BLURREGION; blurBehind.hRgnBlur = region; } return DwmEnableBlurBehindWindow(window, &blurBehind); } LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_INITDIALOG: { SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); EnableBlurBehindWindow(hwnd); } break; case WM_ERASEBKGND: { RECT clientRect; GetClientRect(hwnd, &clientRect); SelectObject((HDC)wParam, GetStockObject(BLACK_BRUSH)); Rectangle((HDC)wParam, 0, 0, clientRect.right, clientRect.bottom); } break; case WM_CLOSE: EndDialog(hwnd, 0); break; } return 0; } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAIN), NULL, (DLGPROC)WndProc); return 0; } --- Is there any further message processing I need to do or anything..? Thanks for your help! --PerspX

    "Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates

    M 1 Reply Last reply
    0
    • P Perspx

      I am using the Microsoft DWM (Desktop Window Manager), and I am using the DwmEnableBlurBehindWindow() function with the WS_EX_LAYERED style.. however, the window renders fine initially, but then when i move the window, it goes all weird and doesnt display the window properly and just displays the window icon and a garbled up title bar about 50pixels wide and 10pixels high.. heres the code: --- HRESULT EnableBlurBehindWindow(HWND window, bool enable = true, HRGN region = 0, bool transitionOnMaximized = false) { DWM_BLURBEHIND blurBehind = { 0 }; blurBehind.dwFlags = DWM_BB_ENABLE | DWM_BB_TRANSITIONONMAXIMIZED; blurBehind.fEnable = enable; blurBehind.fTransitionOnMaximized = transitionOnMaximized; if (enable && 0 != region) { blurBehind.dwFlags |= DWM_BB_BLURREGION; blurBehind.hRgnBlur = region; } return DwmEnableBlurBehindWindow(window, &blurBehind); } LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_INITDIALOG: { SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); EnableBlurBehindWindow(hwnd); } break; case WM_ERASEBKGND: { RECT clientRect; GetClientRect(hwnd, &clientRect); SelectObject((HDC)wParam, GetStockObject(BLACK_BRUSH)); Rectangle((HDC)wParam, 0, 0, clientRect.right, clientRect.bottom); } break; case WM_CLOSE: EndDialog(hwnd, 0); break; } return 0; } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAIN), NULL, (DLGPROC)WndProc); return 0; } --- Is there any further message processing I need to do or anything..? Thanks for your help! --PerspX

      "Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      I don't think you should use WS_EX_LAYERED and glass together. They are two different ways of creating transparency.

      --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

      P 1 Reply Last reply
      0
      • M Michael Dunn

        I don't think you should use WS_EX_LAYERED and glass together. They are two different ways of creating transparency.

        --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

        P Offline
        P Offline
        Perspx
        wrote on last edited by
        #3

        Thanks for your help :) --PerspX

        "Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups