• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
If She Said "Yes".
What'll you do ?
博客园    首页    新随笔    联系   管理    订阅  订阅
Taskbar height in Windows OS ?

[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(该高度即为除去任务栏的高度);

posted on 2011-07-14 18:51  百花盛开  阅读(250)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3