power1power1 Posted January 10, 2014 Share Posted January 10, 2014 Hi, What is the easiest way to check if the mouse pointer is not on top of any open window? Thanks. Link to comment Share on other sites More sharing options...
Morthawt Posted January 10, 2014 Share Posted January 10, 2014 I imagine it would be a CPU intensive process of finding all windows, getting their current state, if they are visible then getting their dimensions, if the current mouse location is within the start and end position of the horizontal and vertical areas then it is on a window and should be ignored. Free and easy Autoit scripting video tutorials (plus more videos always coming!) General video tutorials, especially correct and safe TeamSpeak permissions tutorials. Link to comment Share on other sites More sharing options...
Moderators Solution Melba23 Posted January 10, 2014 Moderators Solution Share Posted January 10, 2014 power1power1,I would use MouseGetPos to get the mouse coordinates and then call _WinAPI_WindowFromPoint to see what is underneath that point. If it is the desktop then you have your answer. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
power1power1 Posted January 10, 2014 Author Share Posted January 10, 2014 Hi Melba23, Thanks for the tip. I looked at the help page for _WinAPI_WindowFromPoint and there is an example code there that does exactly this. I added ConsoleWrite(WinGetTitle($hWnd)&@CRLF) to the loop to get the window title. When mouse pointer is on top of desktop, the window title I am getting is "FolderView", which I didn't expect. When the mouse pointer is on top of the taskbar, I get "Runing applications". What do you think? Maybe I tell you what I am ultimately planning to do and see if you have any other suggestions to do it: I want to use the wheel on my mouse to control the sound volume when the mouse pointer is on top of the taskbar and when it is on top of desktop but not on top of any open windows. Volumouse stopped working when I switched to Windows 8.1: It adjusts the volume when the pointer is on top of takbar but when on top of the desktop, it doesn't do it anymore. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 10, 2014 Moderators Share Posted January 10, 2014 power1power1, What do you think?As long as you can identify that fact that you are over the desktop/taskbar what does it matter what is actually returned? You can now identify the 2 occasions when you want your mousewheel to react. M23P.S. I get the same titles when i run the script. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
power1power1 Posted January 10, 2014 Author Share Posted January 10, 2014 OK, thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now