🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #917

How can I access the backround (root) window?

#917
From: Joe Herman
Date: Tue, 18 Dec 1990 14:36
58 lines
2542 bytes
Hello, I'm trying to write a program which draws in the backround (root)
window.  The method I'm trying doesn't seem to be working for my
program, but it does work for others.  I wonder if someone could tell
me what I'm doing wrong.

I first tried to just draw on in the window returned by GetDesktopWindow(),
but that draws on the desktop, not the backround (i.e. it draws over
everything).

Next I grabbed the source to Brian Farmer's port of fuse.  His fuses move
in the backround so I figure I'd try his method.  Unfortunatly I keep getting
application errors.  Here's what I do:

		...

	/* set up drawing in the backround window */
	/* get the root window descriptor */
	backwin = GetDesktopWindow();
		
	/* now replace the WinProc function for that window with our own */
	rootfunc = (FARPROC) GetWindowLong (backwin, GWL_WNDPROC);
	SetWindowLong (backwin, GWL_WNDPROC, (LONG) ProcessRootMsgs);

		 ...

/* Handle messages coming to the root window.  Basically pass everything */
/* but redraw messages */
long FAR PASCAL ProcessRootMsgs (HWND hWnd, WORD message, WORD wParam, LONG lParam)
{
    if (message != WM_ERASEBKGND)
	return (CallWindowProc (rootfunc, hWnd, message, wParam, lParam));
    RedrawSelf (hWnd, message, wParam, lParam);
    return (1);
}
				

I get an application error on the first message (which is an unknown
message #0x88) that ProcessRootMsgs receives.  I'm also not sure why
I need to use CallWindowProc() instead of just dereferencing the rootfunc
variable, but Brian's code did it that way and the SDK says to do it that
way.

Any help or pointers to source of other programs that write in the backround
window would be appreciated.

				Adthanksvance,

				Joe Herman
				U. of Md.

dzoey@terminus.umd.edu

P.S.  I get the application error when I pass the 0x88 message to
      CallWindowProc().  Since that's the root window, an application
      error there takes me out of windows.  Don't try this at home.

-- 
"Everything is wonderful until you know something about it."
Technical Details
Message-ID: <7734@umd5.umd.edu>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!pacbell.com!ames!haven!umd5!terminus.umd.edu!dzoey

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!pacbell.com!ames!haven!umd5!terminus.umd.edu!dzoey
From: dzoey@terminus.umd.edu (Joe Herman)
Newsgroups: comp.windows.ms.programmer
Subject: How can I access the backround (root) window?
Message-ID: <7734@umd5.umd.edu>
Date: 18 Dec 90 14:36:30 GMT
Sender: news@umd5.umd.edu
Organization: University of Maryland DOSIP-CSC
Lines: 58
Originator: dzoey@terminus.umd.edu