Transparency probleme on my c++ windows.h

23 views Asked by At

I have a window that I define as follows:

hwnd = CreateWindowExA(WS_EX_LAYERED, className, title, WS_POPUP, 0, 0, width, height, NULL, NULL, GetModuleHandle(NULL), this);

It is therefore completely transparent.

I have a simple WM_PAINT as follows:

 WM_PAINT box:
 {
     PAINTSTRUCT ps;
     HDC hdc = BeginPaint(hwnd, &ps);
     if (currentPage)
         currentPage->paintFunction(hwnd, hdc);
     EndPaint(hwnd, &ps);
     break;
 }

with in a met paintFunction example:

RECT rect = {0, 0, 20, 20};
FrameRect(hdc, &rect, (HBRUSH)GetStockObject(GRAY_BRUSH));

I would just like that each time I start WM_PAINT, the old drawings are deleted, and that the window becomes completely transparent again. I tried with setLayeredWindows to use a double buffer but impossible. I can't find an option with brushes compatible with my window to draw transparently. So I come to beg you to guide me towards a potential path to solve my problem! thank you very much and good day !

0

There are 0 answers