correctly play WM_MOUSEWHEEL
-
I try to record and playback application session with help of WH_JOURNALRECORD and WH_JOURNALPLAYBACK hooks but can’t properly playback MOUSEWHEEL event ( rotation direction is ignored) JournalRecordProc and JournalPlaybackProc hook procedures use LPARAM ( pointer to the EVENTMSG structure ) to get/pass message specific information during recording/playing. This EVENTMSG structure has no member for WPARAM information, but key indicator and wheel rotation information are stored in WPARAM of WM_MOUSEWHEEL message. The same problem is with all messages with specific WPARAM info. How I can correctly play WM_MOUSEWHEEL message? Thanks in advance Petr
-
I try to record and playback application session with help of WH_JOURNALRECORD and WH_JOURNALPLAYBACK hooks but can’t properly playback MOUSEWHEEL event ( rotation direction is ignored) JournalRecordProc and JournalPlaybackProc hook procedures use LPARAM ( pointer to the EVENTMSG structure ) to get/pass message specific information during recording/playing. This EVENTMSG structure has no member for WPARAM information, but key indicator and wheel rotation information are stored in WPARAM of WM_MOUSEWHEEL message. The same problem is with all messages with specific WPARAM info. How I can correctly play WM_MOUSEWHEEL message? Thanks in advance Petr
I looked at the definition of the EVENTMSG structure according to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookstructures/eventmsg.asp[^] is:
typedef struct {
UINT message;
UINT paramL;
UINT paramH;
DWORD time;
HWND hwnd;
} EVENTMSG, *PEVENTMSG;There is paramL in there. I'm assuming that's what you're looking for. Greba, My lack of content on my home page should be entertaining.
-
I looked at the definition of the EVENTMSG structure according to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookstructures/eventmsg.asp[^] is:
typedef struct {
UINT message;
UINT paramL;
UINT paramH;
DWORD time;
HWND hwnd;
} EVENTMSG, *PEVENTMSG;There is paramL in there. I'm assuming that's what you're looking for. Greba, My lack of content on my home page should be entertaining.
Thanks for reply But I mean to playback with JournalPlaybackProc : Syntax LRESULT CALLBACK JournalPlaybackProc( int code, WPARAM wParam, LPARAM lParam ); Parameters code [in] Specifies a code the hook procedure uses to determine how to process the message. If code is less than zero, the hook procedure must pass the message to the CallNextHookEx .......... wParam This parameter is not used !!!!!!!!!!!!!!!!!!!. lParam [in] Pointer to an EVENTMSG structure that represents a message being processed by the hook procedure. ----------------------------------------------------------------------- The source of data to fill EVENTMSG structure is WM_MOUSEWHEEL message what returns WPARAM wParam LPARAM lParam; Parameters wParam The high-order word indicates the distance the wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA, which is 120. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. The low-order word indicates whether various virtual keys are down. This parameter can be one or more of the following values. MK_CONTROL The CTRL key is down. MK_LBUTTON The left mouse button is down. MK_MBUTTON The middle mouse button is down. MK_RBUTTON The right mouse button is down. MK_SHIFT The SHIFT key is down. MK_XBUTTON1 Windows 2000/XP: The first X button is down. MK_XBUTTON2 Windows 2000/XP: The second X button is down. lParam The low-order word specifies the x-coordinate of the pointer, relative to the upper-left corner of the screen. The high-order word specifies the y-coordinate of the pointer, relative to the upper-left corner of the screen. ---------------------------------------------------------------------------- As it turns out there is no place in EVENTMSG for data stored in WM_MOUSEWHEEL message wParam. typedef struct { UINT message; UINT paramL; // place for x-coordinate UINT paramH; // place for y-coordinate DWORD time; HWND hwnd;} EVENTMSG, *PEVENTMSG;
-
Thanks for reply But I mean to playback with JournalPlaybackProc : Syntax LRESULT CALLBACK JournalPlaybackProc( int code, WPARAM wParam, LPARAM lParam ); Parameters code [in] Specifies a code the hook procedure uses to determine how to process the message. If code is less than zero, the hook procedure must pass the message to the CallNextHookEx .......... wParam This parameter is not used !!!!!!!!!!!!!!!!!!!. lParam [in] Pointer to an EVENTMSG structure that represents a message being processed by the hook procedure. ----------------------------------------------------------------------- The source of data to fill EVENTMSG structure is WM_MOUSEWHEEL message what returns WPARAM wParam LPARAM lParam; Parameters wParam The high-order word indicates the distance the wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA, which is 120. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. The low-order word indicates whether various virtual keys are down. This parameter can be one or more of the following values. MK_CONTROL The CTRL key is down. MK_LBUTTON The left mouse button is down. MK_MBUTTON The middle mouse button is down. MK_RBUTTON The right mouse button is down. MK_SHIFT The SHIFT key is down. MK_XBUTTON1 Windows 2000/XP: The first X button is down. MK_XBUTTON2 Windows 2000/XP: The second X button is down. lParam The low-order word specifies the x-coordinate of the pointer, relative to the upper-left corner of the screen. The high-order word specifies the y-coordinate of the pointer, relative to the upper-left corner of the screen. ---------------------------------------------------------------------------- As it turns out there is no place in EVENTMSG for data stored in WM_MOUSEWHEEL message wParam. typedef struct { UINT message; UINT paramL; // place for x-coordinate UINT paramH; // place for y-coordinate DWORD time; HWND hwnd;} EVENTMSG, *PEVENTMSG;
Petr P. wrote: UINT paramL; // place for x-coordinate UINT paramH; // place for y-coordinate I don't know if what you stated above is correct. Under my system I follow this logic: WPARAM is defined as UINT_PTR which in turn is defined as unsigned int LPARAM is defined as LONG_PTR which in turn is defined as long UINT is defined as unsigned int And also under my system sizeof(long) == sizeof(unsigned int). This means that you have enough space in the EVENTMSG structure being passed in to store everything. I doubt there would be any conversion nessisary. I think all you would have to do is store your WPARAM and LPARAM in paramL and paramH. Greba, My lack of content on my home page should be entertaining.
-
Petr P. wrote: UINT paramL; // place for x-coordinate UINT paramH; // place for y-coordinate I don't know if what you stated above is correct. Under my system I follow this logic: WPARAM is defined as UINT_PTR which in turn is defined as unsigned int LPARAM is defined as LONG_PTR which in turn is defined as long UINT is defined as unsigned int And also under my system sizeof(long) == sizeof(unsigned int). This means that you have enough space in the EVENTMSG structure being passed in to store everything. I doubt there would be any conversion nessisary. I think all you would have to do is store your WPARAM and LPARAM in paramL and paramH. Greba, My lack of content on my home page should be entertaining.
Interesting idea. I have tried to put contents of wParam words to high-order words of EVENTMSG ParamL/ParamH . Regrettably it does not work. System works with X/Y coordinates only . So problem pending. BR Petr
-
I try to record and playback application session with help of WH_JOURNALRECORD and WH_JOURNALPLAYBACK hooks but can’t properly playback MOUSEWHEEL event ( rotation direction is ignored) JournalRecordProc and JournalPlaybackProc hook procedures use LPARAM ( pointer to the EVENTMSG structure ) to get/pass message specific information during recording/playing. This EVENTMSG structure has no member for WPARAM information, but key indicator and wheel rotation information are stored in WPARAM of WM_MOUSEWHEEL message. The same problem is with all messages with specific WPARAM info. How I can correctly play WM_MOUSEWHEEL message? Thanks in advance Petr
Problem is solved. I don't find better way, than to mix WH_JOURNALRECORD hooks with interseption of WM_MOUSEWHEEL and sinchronising this messages on play.