I'm trying to execute an action when a pixel changes in a window by using SetWindowsHookEx
. I can successfully recieve Windows messages, but most messages are called while no screen updates occur, and some messages are called more than once on one pixel.
// WH_GETMESSAGE doesn't call the callback for some reason...
SetWindowsHookEx(WH_CALLWNDPROC, hhookSysMsg, hinstDLL, GetWindowThreadProcessId(hwnd, NULL));
I tried listening for WM_PAINT
, WM_NCPAINT
, and WM_ERASEBKGND
, but for some reason they don't fire every time - for example, in Notepad, it does not fire when the scrollbar colors change (for example when hovering over them with the cursor) or changing the text itself.
switch (msg->message)
{
// doesn't catch all screen updates!
case WM_PAINT:
case WM_NCPAINT:
case WM_ERASEBKGND:
// Bit-blit the screen to a file/process the screen/etc.
...
default:
break;
}
Can someone help me out with this? If there's no concrete event that runs when a pixel is changed within a window, is there a list of events that I can do a switch-case expression on?