Products
Technologies

Developer resources

Taskbar height in Windows OS ?

Avg. Rating 4.1

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 :)

 

 


+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes