views:

29

answers:

2

I am trying to write a program that monitors when the screen has been redrawn. Meaning if any part of any window is redrawn, then the program is notified.

As far as I understand I should use a journal record hook like at http://www.vbaccelerator.com/home/vb/code/libraries/Hooks/Journal_Record_Hooks/article.asp

However, I do not understand which MSG type would get me the WM_PAINT events (WH_CALLWNDPROC and WH_CALLWNDPROCRET do not seem to do the job). I'm not even sure that WM_PAINT is what I'm looking for...

Basically, if I knew when the DC associated with GetDesktopWindow() has changed then my problem would be solved.

Question is: How do you monitor screen updates?

+1  A: 

I don't believe this is possible without hooking the display driver. I can imagine there would be some serious performance implications if it were possible in general...

Dean Harding
On vista it seems that journal record hooks require a signed exe (see http://www.tech-archive.net/Archive/Development/microsoft.public.win32.programmer.ui/2007-10/msg00143.html) so I have given up on hooking. Moreover it seems that the new DWM thumbnail api-s do not lend them selves to capturing their content:(
A: 

You would be better taking a screenshot every second or whatever. Every version of Windows has the little network icon in the tray always changing when you transfer data over a network, meaning the screen will be changing pretty much constantly.

Coronatus