Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. correctly play WM_MOUSEWHEEL

correctly play WM_MOUSEWHEEL

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 1659528
    wrote on last edited by
    #1

    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

    G U 2 Replies Last reply
    0
    • U User 1659528

      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

      G Offline
      G Offline
      greba
      wrote on last edited by
      #2

      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.

      U 1 Reply Last reply
      0
      • G greba

        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.

        U Offline
        U Offline
        User 1659528
        wrote on last edited by
        #3

        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;

        G 1 Reply Last reply
        0
        • U User 1659528

          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;

          G Offline
          G Offline
          greba
          wrote on last edited by
          #4

          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.

          U 1 Reply Last reply
          0
          • G greba

            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.

            U Offline
            U Offline
            User 1659528
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • U User 1659528

              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

              U Offline
              U Offline
              User 1659528
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups