[Solved] MonitorWorkArea fails

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Chef
Posts: 50
Joined: 14 Nov 2013, 13:01

[Solved] MonitorWorkArea fails

13 Dec 2013, 11:40

Run this and move the taskbar around and resize it, it doesn't always detect position changes, and even when it does the measurement isn't always accurate.
Any alternative?

Code: Select all

#NoEnv
#Persistent
#SingleInstance force

setTimer, MonitorWorkArea, 500
return

MonitorWorkArea:
	sysGet, mwa, MonitorWorkArea
	mwa := mwaRight " x " mwaBottom
	if !(mwa_old = mwa)
	{
		soundPlay, *48
		SplashTextOn, 300, 60, MonitorWorkArea,  % "`n" mwa_old := mwa
	}
	return
Windows 7 32 bit

--------------------------

Solution:
Last edited by Chef on 17 Dec 2013, 06:59, edited 4 times in total.
User avatar
MilesAhead
Posts: 232
Joined: 03 Oct 2013, 09:44

Re: MonitorWorkArea fails

13 Dec 2013, 12:03

http://stackoverflow.com/questions/2701 ... r-is-moved

The other thing is, if the taskbar is at the top or on the left edge, the Right number will not be the resolution width and the bottom number will not be the resolution height. You have to do b - t to get the height and r - l to get the width. Also if AutoHide is enabled on the taskbar, GetWorkArea API will just return the screen resolution. You have to let your users know that AutoHide must be disabled for your utility to work(or use some other technique.)

From my playing around it seemed to me that screen resolution change notification worked fine. But taskbar position change notification wasn't worth diddly.

Edit: I don't know what your utility will do but for my stuff, moving things around when the user hits a hotkey, I just calculate the work area every time the user hits the hotkey, rather than trying to be notified by the system. It's way more reliable.
"My plan is to ghostwrite my biography. Then hire another writer to put his
name on it and take the blame."

- MilesAhead
User avatar
Chef
Posts: 50
Joined: 14 Nov 2013, 13:01

Re: MonitorWorkArea fails

13 Dec 2013, 12:18

Well, I still this think this command is broken and needs some work.

But because I need this for my current project I started writing my own function to get the working area by
getting the size and position of the taskbar.
Everything was Ok until I couldn't find a way to get if AutoHide is on or off, is there a way to get that?
Its not in the registry and even if it is then its not reliable to read it from there as windows doesn't
update that immediately.
User avatar
MilesAhead
Posts: 232
Joined: 03 Oct 2013, 09:44

Re: MonitorWorkArea fails

13 Dec 2013, 13:09

Using the SysGet function, if Monitor and MonitorWorkArea return the same results, then I assume AutoHide is enabled. But it shows here how to get the message etc.. http://stackoverflow.com/questions/9900 ... is-enabled

Edit: if you search the forum you may find some ahk code that uses that scheme.
"My plan is to ghostwrite my biography. Then hire another writer to put his
name on it and take the blame."

- MilesAhead
User avatar
Chef
Posts: 50
Joined: 14 Nov 2013, 13:01

Re: MonitorWorkArea fails

13 Dec 2013, 14:11

Solved to get AutoHide state using ABM_GETSTATE
Thanks MilesAhead Image
User avatar
MilesAhead
Posts: 232
Joined: 03 Oct 2013, 09:44

Re: MonitorWorkArea fails

13 Dec 2013, 15:17

:)
"My plan is to ghostwrite my biography. Then hire another writer to put his
name on it and take the blame."

- MilesAhead

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, inseption86, jaka1, LuckyJoe, Rohwedder and 324 guests