如何直接在桌面上绘图
我根据GetDesktopWindow函数写了这么一段代码
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
HWND hWnd;
HDC hdc;
TCHAR szBuf[] = "CSDN社区";
while(1)
{
hWnd = GetDesktopWindow();
hdc = GetDC(hWnd);
TextOut( hdc, 0, 0, szBuf, strlen(szBuf) );
}
return 0;
}
经检查hWnd和hdc均不为NULL。但程序什么也不做。
引:MSDN中关于GetDesktopWindow的描述
The GetDesktopWindow function returns a handle to the desktop window. The desktop window covers the entire screen. The desktop window is the area on top of which all icons and other windows are painted.