I am trying to detect the movement of the mouse wheel (while the CTRL key is pressed) using a TApplicationEvents.OnMessage event in Delphi 7. This is the code I am using:
if Msg.message = WM_MOUSEWHEEL then begin
if Word(Msg.wParam) = MK_CONTROL then begin
Edit1.Text := IntToStr(HiWord(Msg.wParam));
if HiWord(Msg.wParam) < 0 then begin
IncZoom;
end else begin
DecZoom;
end;
end;
end;
According to the MSDN resource (http://msdn.microsoft.com/en-us/library/windows/desktop/ms645617(v=vs.85).aspx ) a negative value for the HiWord of (Msg.wParam) indicates that the wheel has been moved backward, toward the user.
Problem is, I never receive a negative value when the wheel is moved backward. When I scroll backward, I get a value of 120. When I scroll forward, I get 65416.
What am I doing wrong?