Win32. Writing on windows desktop
Hello!
Is it possible to write text with TextOut on the Desktop of my pc. I am using win32 within a win32 console application. Do i have to use a non win32 console application. I have the following steps but it doesn work:
Code:
HGDIOBJ oldPen, oldBrush;
RECT mRect;
PAINTSTRUCT ps;
HWND hwnd = GetDesktopWindow();
::GetClientRect( hwnd, &mRect );
BeginPaint( hwnd, &ps );
//set the color
oldPen = SelectObject( ps.hdc, GetStockObject( WHITE_PEN ) );
oldBrush = SelectObject( ps.hdc, GetStockObject( WHITE_BRUSH ) );
//set BKGround-Mode
SetBkMode( ps.hdc, TRANSPARENT );
//Output
if ( !TextOut( ps.hdc, mRect.right/2, mRect.bottom/2, "hallo wie gehts dir denn so", 10 ) )
std::cerr << "Keine Ausgabe möglich!!" << std::endl;
Ellipse( ps.hdc, 100, 100, 400, 400 );
//Reset pens und brushes
SelectObject( ps.hdc, oldPen );
SelectObject( ps.hdc, oldBrush );
EndPaint( hwnd, &ps );
I think everything is all rigth but it doesn´t work....Thanks.