[comp.windows.ms.programmer] Writing to Root window

swonk@toshais.UUCP (Glenn L. Swonk) (06/07/91)

Can anyone suggest a way to write (draw) on the
root window? Does anyone know how the screen
saver programs like screenpeace, intermission or
afterdark work?

thanks
glenn

bonneau@hyper.hyper.com (Paul Bonneau) (06/11/91)

In article <216@toshais.UUCP> swonk@toshais.UUCP (Glenn L. Swonk) writes:
>Can anyone suggest a way to write (draw) on the
>root window? Does anyone know how the screen
>saver programs like screenpeace, intermission or
>afterdark work?
>
As for drawing on the desktop (root window):

	HWND	hwndDesk	= GetDeskTopWindow();
	HDC	hdc		= GetDC(hwndDesk);

	/* Draw to your heart's content with the dc. */
	ReleaseDC(hwndDesk, hdc);

cheers - Paul Bonneau.

mikec@ersys.edmonton.ab.ca (Mike Coward) (06/15/91)

swonk@toshais.UUCP (Glenn L. Swonk) writes:

> Can anyone suggest a way to write (draw) on the
> root window? Does anyone know how the screen
> saver programs like screenpeace, intermission or
> afterdark work?
> glenn
 
The easiest way to get a device context to the screen
is to call GetDC with a parameter of 0.  ie:
ScreenDC = GetDC(0);
Another way to do something similar to screen blankers
is to create a window with the dimensions of the screen
and write on that window...
Mike

/save

Mike Coward              mikec@ersys.edmonton.ab.ca
Edmonton Remote Systems:  Serving Northern Alberta since 1982

kensy@microsoft.UUCP (Ken SYKES) (06/24/91)

In article <uPoJ41w164w@ersys.edmonton.ab.ca> mikec@ersys.edmonton.ab.ca (Mike Coward) writes:
>swonk@toshais.UUCP (Glenn L. Swonk) writes:
>The easiest way to get a device context to the screen
>is to call GetDC with a parameter of 0.  ie:
>ScreenDC = GetDC(0);


Or ScreenDC = GetDC(GetDesktopWindow());

That way you aren't depending on NULL behavior.  This function is
new for 3.0.

Ken Sykes
Disclaimer: The above opinions are solely my own.

aaron@jessica.stanford.edu (Aaron Wallace) (06/24/91)

In article <73102@microsoft.UUCP> kensy@microsoft.UUCP (Ken SYKES) writes:
>In article <uPoJ41w164w@ersys.edmonton.ab.ca> mikec@ersys.edmonton.ab.ca (Mike Coward) writes:
>>swonk@toshais.UUCP (Glenn L. Swonk) writes:
>>The easiest way to get a device context to the screen
>>is to call GetDC with a parameter of 0.  ie:
>>ScreenDC = GetDC(0);
>
>
>Or ScreenDC = GetDC(GetDesktopWindow());
>
>That way you aren't depending on NULL behavior.  This function is
>new for 3.0.

Are these the same?  I thought that the former got a DC to the entire
screen, while the latter gets a DC which is clipped to all visible windows
on the screen...

Aaron Wallace