Question: I find that the rectangle drawed by Rectangle function(included in WinGDI.h) will not show in windows 7 sysytem(64 bit), but it can display in windows 10. Is there any differences between win7 and win10? And are there other ways to do draw a shape above desktop in win7?
Environment: Windows 7 64 bit and Windows 10 64 bit.
Tools: Microsoft Visual Studio, Windows SDK, GDI.
Related C++ code:
HDC hDcWnd = GetDC(GetDesktopWindow());
HPEN hPen = CreatePen(PS_SOLID, 6 ,RGB(30,30,30));
HPEN hOldPen = (HPEN)SelectObject(hDcWnd,hPen);
HBRUSH hBrush = CreateSolidBrush(RGB(0,49,79));
HBRUSH hOldBrush = (HBRUSH)SelectObject(hDcWnd,hBrush);
Rectangle(hDcWnd,x1,y1,x2,y2);
SelectObject(...); //the following code is ignored here