[source adress]http://cookbooks.adobe.com/post_Taskbar_height_in_Windows_OS__-10823.html
Problem
I want to alert my users like MSN alert when new user login or new email , but i can't determine the height of the taskbar to display my alert window above it :( .
Solution
Make new invisible window with none system chrome , maximize it , then the task bar height will be screen height - maximized window height .
Detailed explanation
Here's the steps in the code :
1- Create NativeWindowInitOptions and set the systemChrome property to none .
2- create new rectangle with any x,y,width,height values .
3- load blank page (blank.html) contain nothing but white space to be light fast in the new window .
4- maximize the new invisible window .
5- substract invisible window height from the screen height , you will find the taskbar accurate height .
6- you can store the value in Encrypted local store for future , but here i don't take this step
var options = new air.NativeWindowInitOptions();
options.systemChrome= air.NativeWindowSystemChrome.NONE;
var rectangle = new air.Rectangle(100,100,100,100);
var loader = air.HTMLLoader.createRootWindow(false,options,false,rectangle);
loader.load(new air.URLRequest(air.File.applicationDirectory.resolvePath("blank.html").url))
var myWindow = loader.window.nativeWindow ;
myWindow.maximize();
var taskbarHeight = air.Capabilities.screenResolutionY - myWindow.height;
alert(taskbarHeight)
the new window that will use taskbar height should have Y of this value
Y = air.Capabilities.screenResolutionY - windowHeight - taskbarHeight
and the result will be exactly the same as in the picture :)
NOTE:
在OfficeAnywhere项目中,因为主窗体是最大化的,所以不需要上文那样做,因为很容易获得主窗口的高度,获得任务栏高度变很简单了。
var taskHeight:int =Capabilities.screenResolutionY - mx.core.FlexGlobals.topLevelApplication.height(该高度即为除去任务栏的高度);