I want to show the GPU and CPU usage/temperature on the right upper corner as text on every opened window, like desktop, explorer, internet browser,... My problem is, I can display the text only with a background but can not make them transparent.
I draw the text with following code:
int WINAPI main(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
HWND desktopHandle = GetDesktopWindow();
HDC desk = GetDC(desktopHandle);
const char text[] = "Hello!";
RECT lprec = { 900 , 200, 500, 500 };
int dres;
while(1)
{
Sleep(1);
dres = DrawText(desk, text, -1, &lprec, DT_BOTTOM | DT_INTERNAL | DT_NOCLIP); // | DT_INTERNAL | DT_NOCLIP
//dres = TextOutA(desk, 200, 200, text, lstrlenA(text));
if(dres == 0) printf("Test: %i, [%llu]\r\n", dres, GetLastError());
UpdateWindow(desktopHandle);
InvalidateRect(desktopHandle, &lprec, 1 );
RedrawWindow(desktopHandle, &lprec, NULL, RDW_ERASE | RDW_INVALIDATE);
//SelectObject(desk, oldFont);
SetLayeredWindowAttributes(desktopHandle, 0x000000, 0, 2);
if(kbhit())
{
//DeleteObject(font);
ReleaseDC(desktopHandle, desk);
return 0;
}
}
}
Here is a small image from my desktop how it looks like:

If the winnapi can not do this, external C librarys was also ok. I read something about SFML but I do not know if this is what I search.
I found a way. Add
WS_POPUPfor full transparency. If required, set the GUI to foreground.Code: