PatBlt does not work

chalkboardninja 6 Reputation points
2022-06-14T12:34:26.95+00:00

hey guys i need help
nothing is appearing unless I use rep "WHITENESS" or rep "BLACKNESS"

here's the code:
HBRUSH brush = CreateSolidBrush(RGB(0, 255, 255));

SelectObject(desk, brush);  
              
PatBlt(desk, 100, 100, 800, 600, PATINVERT); // the drawing goes here  
  
 DeleteObject(brush);  

yeah... it does look right but I'm not false-reporting
can somebody help? (also one more bit of information I want the code to run when a button in a Win32 GUI is clicked)

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
1,897 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 65,791 Reputation points
    2022-06-14T12:58:51.743+00:00

    If I test on the Desktop DC, this works :

                    HDC hDC = GetDC(NULL);  
                    HBRUSH hBrush = CreateSolidBrush(RGB(0, 255, 255));  
                    HBRUSH hBrushOld = (HBRUSH)SelectObject(hDC, hBrush);  
                    PatBlt(hDC, 100, 100, 800, 600, PATINVERT);  
                    SelectObject(hDC, hBrushOld);  
                    DeleteObject(hBrush);  
                    ReleaseDC(NULL, hDC);  
    

    211345-patblt.jpg