Caveats
You must watch several things carefully when
using the WH_JOURNALPLAYBACK hook. First, you must
watch for different screen resolutions. A macro recorded in one
resolution might not play back correctly in a different resolution.
As a test, record a macro using the application you built in this
chapter at a resolution of 640x480. Then, switch to a higher
resolution, such as 1024x768. You will notice that the x and y
coordinates of the mouse during playback at the higher resolution are
scaled down, as if the system still thinks the resolution is 640x480.
You also must watch for a window changing locations when the macro is played back. The played back macro still assumes that the window is in its original position and plays back the macro accordingly. Similar problems arise with windows that become covered by another window, windows that become hidden, or windows that become destroyed.
Macros recorded in one operating system (Windows 9x, NT, or 2000) can have problems when played back in a different operating system. Some causes for these problems might be:
The messages that are recorded in one operating system might not exist on the operating system in which that the macro is being played back.
Different resolutions.
Different desktop layouts.
Different mouse setups (e.g., if a snap-to or wrapping option is set for the mouse in one operating system and not in the other).
Problems also could arise after the macro has finished playing. Remember that messages are still being placed ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access