home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.ms-windows.programmer.misc
- Path: sparky!uunet!sun-barr!cs.utexas.edu!torn!watserv2.uwaterloo.ca!watserv1!monet.uwaterloo.ca!mehran
- From: mehran@monet.uwaterloo.ca (Mehran Farimani)
- Subject: Re: Subclassing non-client painting of all windows
- Message-ID: <Bxn9J4.Eno@watserv1.uwaterloo.ca>
- Sender: news@watserv1.uwaterloo.ca
- Organization: University of Waterloo
- References: <1992Nov12.135030.593@monu6.cc.monash.edu.au>
- Date: Fri, 13 Nov 1992 07:45:03 GMT
- Lines: 49
-
- In article <1992Nov12.135030.593@monu6.cc.monash.edu.au> sloth@yoyo.cc.monash.edu.au (Andrew Bulhak) writes:
- > I would like to know how to go about intercepting the Windows non-client
- >painting/hit-testing behaviour _system-wide_ and reacting to it.
- >I would like to write an app that intercepts these calls and allows the
- >Windows look-and-feel to be subtly modified (i.e., bas-relief title
- >bars, different/repositioned minimize/maximize controls,
- >left/right-justified titles, etc.)
- >
- > The problem is, firstly, how do do this. wm_NCPaint and wm_NCHitTest (and some
- >other nice functions) don't come with a window handle, DC, cursor
- >position or anything else remotely useful.
- >
- > And secondly, how do I set this up? I suspect that it may have something
- >to do with making a DLL that contains a replacement DefaultWindowProc()
- >(although I could be wrong, and it may have something to do with hooks.)
- >This DLL trick is explained in Petzold, but only for *one* application,
- >and with that application's consent and co-operation. How would I
- >intercept *all* messages, system-wide, identify the windows that they
- >apply to, let them run their course (if necessary), and add my own
- >finishing touch? Anyone done this sort of thing?
- >
-
- You could write an interceptor DLL for USER (the way Petzold says it) to
- intercept DefWindowProc(), but that would mean that you have to provide
- entries for all USER services in your DLL.
-
- A better solution is to patch the function with a far jump to your function.
- In your function, you then could process the messages that you want (things
- like WM_NCPAINT and WM_NCATCTIVATE), then unpatch the original function,
- call it, and repatch it. It's actually quite simple, and it doesn't have
- to be in a DLL. But you might wanna do that early enough in the boot process.
-
- Getting it in there early in the boot process can complicate things a little.
- A better way would be to run your program from the "load/run" line of
- your win.ini. It could even be a program that you can run at any point
- during your windows session. Then, to make sure that you are repainting
- all of the windows, you just walk the window list and force all windows to
- do an NC_PAINT by either sending it a WM_NCPAINT message (note that this
- message takes an undocumented parameter as its wParam: the clipping REGION),
- or if you are focusing on 3.1 only, you could just use RedrawWindow() (not
- available in 3.0).
-
- Good luck ...
-
- Regards,
-
- --Mehran
-
- windows the way you
-