Can't draw to SysListView32 control on Win 7?

1k Views Asked by At

I'm trying to draw an animation to the desktop(A polar clock is my final goal), but I can't seem to manage to draw to the desktop.

I can get the handle and the DC for the window with this code:

HWND progMan  = FindWindow("progMan", NULL); 
HWND shellDLL = FindWindowEx(progMan, NULL, "SHELLDLL_DefView", NULL);
HWND sysList  = FindWindowEx(shellDLL, NULL, "SysListView32", NULL);
HDC hdc = GetDC(progMan);

and I can use this code to write text, which works when getting at other windows or controls:

while(true) TextOut(hdc, 50, 50, "Hello World!", 13);

but I can't seem to manage to get it to work on the SysListView32 control.

Is this some quirk of Windows 7 or is my code just bugged?

Edit: I'd like to get this to work, but worst-case, does anyone else have any other method of drawing to the desktop behind the icons?

2

There are 2 best solutions below

3
On

Try Spy to get the correct order of the Windows . I had written this code sometime back, not sure if I have it with me right now . However Spy helped me a lot. Though this link has nothing to do with the desktop - http://blogs.msdn.com/b/oldnewthing/archive/2004/07/20/188696.aspx , you might get some help from this too.

0
On

Replace Progman with WorkerW and it should work in most cases. But there is more to it, so search the web for details.