Well, after a brainstorm I think I know the problem. When the main monitor is above the primary monitor, the mouse coordinates will be negative, and these 2 lines don't handle negative numbers.
Pt.X := Word(Msg.lParam); Pt.Y := HiWord(Msg.lParam); Should these be something like.. Pt.X := SmallInt(Msg.lParam); Pt.Y := SmallInt(HiWord(Msg.lParam)); I'll give that a go and send the user. Ross. From: Ross Levis [mailto:[email protected]] Sent: Sunday, 17 August 2014 11:03 p.m. To: 'Moderated List for the Discussion of Delphi Programming excluding Database-related topics' Subject: Mouse wheel scrolling issue with 2 monitors with Delphi 7 I would use the Embarcadero discussion forum website but it's been down every time I've gone there recently. Below are the words from a user who has 2 monitors. I don't have 2 monitors here so I can't test or debug the issue. I have two monitors. #1 and #2. #1 is physically located above #2 and historically I have had monitor #2, on the bottom, be the primary display. When #2 is set as my PRIMARY display. Your software will NOT scroll with the mouse wheel when those programs are on monitor #1 (the secondary display) They will scroll on monitor #2 (primary) But when I make #1 my primary display, your software will scroll on BOTH monitors just fine. The problem is only when I make #2 the primary display. Then they don't scroll on the secondary display. Other programs such as IE, Chrome, Firefox, Word, Notepad, do not behave like this. Just your apps. I am using some code I found which enables scrolling of the window the mouse is currently hovering over, rather than scrolling the window that has focus. Here it is the code somewhat shortened as it has support for datetimepickers and other components removed. procedure MouseWheelMessage(var Msg: tagMSG; var Handled: Boolean); var Pt: TPoint; C: TWinControl; begin if Msg.message = WM_MOUSEWHEEL then begin Pt.X := Word(Msg.lParam); Pt.Y := HiWord(Msg.lParam); C := FindVCLWindow(Pt); if C = nil then Handled := True else if (C.Handle <> Msg.hwnd) and ((C is TCustomListControl) or (C is TCustomEdit)) then begin Handled := True; C.Perform(WM_MOUSEWHEEL, Msg.wParam, Msg.lParam); end; end; end; Could this be causing the problem? Thanks, Ross. _______________________________________________ Delphi mailing list [email protected] http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
