tag:blogger.com,1999:blog-5314745381778741517.post6642178316531239049..comments2024-03-27T07:20:43.406+00:00Comments on LazPlanet: How to detect Mouse Events outside your FormAdnan Shameemhttp://www.blogger.com/profile/03795435968155667026noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-5314745381778741517.post-80624191170361298782021-01-28T16:40:37.810+00:002021-01-28T16:40:37.810+00:00Great article - THANKS!
It saved me a lot of time...Great article - <b>THANKS!</b><br /><br />It saved me a lot of time searching for WinAPI calls.<br />I've built a form in Delphi 10.4 using this code with practically no adjustments.<br />Tested on 4k display - mouse coordinates seem to be reported exactly as expected in full screen coordinate system (inverted Y-axis). Even moves/clicks on dynamically exposed taskbar era reported.john61https://www.blogger.com/profile/07505205283575173184noreply@blogger.comtag:blogger.com,1999:blog-5314745381778741517.post-74523874937916749782020-06-08T21:59:07.804+01:002020-06-08T21:59:07.804+01:00Worked it out. I commented out the line before the...Worked it out. I commented out the line before the var clause and it started to work.al_kinnonhttps://www.blogger.com/profile/15497266618147221227noreply@blogger.comtag:blogger.com,1999:blog-5314745381778741517.post-60716316555151546292020-06-08T20:56:50.500+01:002020-06-08T20:56:50.500+01:00Hi, great article.
I'm getting an issue in m...Hi, great article. <br /><br />I'm getting an issue in my FormCreate procedure for this line:<br /><br />mHook := SetWindowsHookEx(WH_MOUSE_LL, @LowLevelMouseHookProc, hInstance, 0);<br /><br />The error is:<br /><br />inpview_unit1.pas(111,64) Error: Incompatible type for arg no. 2: Got "< address of function(LongInt;LongInt;LongInt):LongInt;StdCall >", expected ""<br /><br />It seems to want to include the parameters for LowLevelMouseHookProc.<br /><br />I'm using Lazarus 1.8.4 (dated 2019-09-18) FPC 3.0.4<br />Windows 10 x64<br /><br />Can Anyone help?al_kinnonhttps://www.blogger.com/profile/15497266618147221227noreply@blogger.comtag:blogger.com,1999:blog-5314745381778741517.post-43564820502415524752019-09-01T15:49:34.678+01:002019-09-01T15:49:34.678+01:00Tip for anyone who will run on this tutorial
Very ...Tip for anyone who will run on this tutorial<br />Very usefull tutorial, although I had to modify it otherwise it wouldn't start. I'm using Lazarus IDE v1.8.4 with FPC 3.0.4 on Windows10 64bit<br />change:<br />function LowLevelMouseHookProc(nCode, wParam, lParam : integer) : integer; stdcall;<br />to:<br />function LowLevelMouseHookProc(nCode: integer; wParam: WPARAM; lParam : LPARAM): LRESULT; stdcall; <br /><br />Cheers<br />Rafterefere in da londonhttps://www.blogger.com/profile/03984829470919657433noreply@blogger.comtag:blogger.com,1999:blog-5314745381778741517.post-22045335868169606722018-05-23T06:54:17.985+01:002018-05-23T06:54:17.985+01:00@tsr84
Hello.
Well, that's a nice question. Bu...@tsr84<br />Hello.<br />Well, that's a nice question. But unfortunately I don't have a straight forward answer to that.<br />For linux, there might be something in the x.org api to handle this: <a href="https://www.x.org/wiki/guide/" rel="nofollow">https://www.x.org/wiki/guide/</a><br />For Mac there could be something in the APIs: <a href="https://developer.apple.com/documentation/" rel="nofollow">https://developer.apple.com/documentation/</a><br /><br />You'll have to search yourself and find a solution for each platform. If its important to you, you can contact platform specific developers to get a better idea, and then port the solution to Lazarus.<br /><br />Another easier cross platform way is to use something else that is cross platform to achieve what you want. For example, when clicked outside form, the form loses focus. So, you can use OnDeactivate to detect if clicked outside. This is not precise, but a good alternative when you are not looking for perfection.<br /><br />Hope that helps.<br />Regards.Adnan Shameemhttps://www.blogger.com/profile/03795435968155667026noreply@blogger.comtag:blogger.com,1999:blog-5314745381778741517.post-42701522743209197162018-05-22T17:35:08.478+01:002018-05-22T17:35:08.478+01:00But how to do it in Linux or crossplatform?But how to do it in Linux or crossplatform?Anonymoushttps://www.blogger.com/profile/00113978286974794873noreply@blogger.com