home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / os / mswindo / programm / misc / 3407 < prev    next >
Encoding:
Text File  |  1992-11-13  |  2.9 KB  |  61 lines

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