Adobe AIR 中在系统托盘中启动的小部件

发布于 2024-12-05 10:53:23 字数 197 浏览 1 评论 0原文

提前致谢。

我需要开发一个简单的小部件。

用于检查某些服务的交通灯绿色和红色图标。

我把所有的图形和图标都做成了16*16,以便在winXp的系统托盘中制作一个图标。 没关系。

但: 我需要应用程序在没有主区域的系统托盘中启动,因此单击图标会出现主区域。

再次感谢。

thanks in advance.

I need to develop a simple widget.

A traffic light green and red icon to check some services.

I made all the graphic and the icon 16*16 to make an icon in the systray of winXp.
That's ok.

But:
I need that the application starts in the systray without the main area and therefore clicking the icon the main area appears.

Thanks again.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

遥远的绿洲 2024-12-12 10:53:23

您所要做的就是使主应用程序窗口默认不可见。并在应用程序的开头设置一个 DockIcon。
您可以在应用程序描述符文件中将initialWindows 属性设置为 false 。可以使用 flash.desktop 设置系统托盘。系统托盘图标

如果您使用 HTML,那么您需要做的事情几乎是相同的。您的描述符文件不应显示初始窗口,并且可以使用 air.NativeApplication.nativeApplication.icon.bitmaps 设置 SystemTray 图标。经过快速的 Google 搜索后,我在 Adobe 网站

<html> 
<head> 
<script src="AIRAliases.js" language="JavaScript" type="text/javascript"></script> 
<script language="JavaScript" type="text/javascript"> 
    var iconLoadComplete = function(event) 
    { 
        air.NativeApplication.nativeApplication.icon.bitmaps = [event.target.content.bitmapData]; 
    } 

    air.NativeApplication.nativeApplication.autoExit = false; 
    var iconLoad = new air.Loader(); 
    var iconMenu = new air.NativeMenu(); 
    var exitCommand = iconMenu.addItem(new air.NativeMenuItem("Exit")); 
    exitCommand.addEventListener(air.Event.SELECT,function(event){ 
            air.NativeApplication.nativeApplication.icon.bitmaps = []; 
            air.NativeApplication.nativeApplication.exit(); 
    }); 

    if (air.NativeApplication.supportsSystemTrayIcon) { 
        air.NativeApplication.nativeApplication.autoExit = false; 
        iconLoad.contentLoaderInfo.addEventListener(air.Event.COMPLETE,iconLoadComplete); 
        iconLoad.load(new air.URLRequest("icons/AIRApp_16.png")); 
        air.NativeApplication.nativeApplication.icon.tooltip = "AIR application"; 
        air.NativeApplication.nativeApplication.icon.menu = iconMenu; 
    } 

    if (air.NativeApplication.supportsDockIcon) { 
        iconLoad.contentLoaderInfo.addEventListener(air.Event.COMPLETE,iconLoadComplete); 
        iconLoad.load(new air.URLRequest("icons/AIRApp_128.png")); 
        air.NativeApplication.nativeApplication.icon.menu = iconMenu; 
    } 

</script> 
</head> 
<body> 
</body> 
</html>

All you have to do is make your main application window invisible by default. And set a DockIcon at the start of your application.
You can set the initialWindows property to false in the application descriptor file. The SystemTray can be set by using flash.desktop.SystemTrayIcon.

If you're working with HTML what you'll need to to is pretty much the same. Your descriptor file should not show the initial window and the SystemTray icon can be set by using air.NativeApplication.nativeApplication.icon.bitmaps. After a quick Google search I found this on the Adobe site:

<html> 
<head> 
<script src="AIRAliases.js" language="JavaScript" type="text/javascript"></script> 
<script language="JavaScript" type="text/javascript"> 
    var iconLoadComplete = function(event) 
    { 
        air.NativeApplication.nativeApplication.icon.bitmaps = [event.target.content.bitmapData]; 
    } 

    air.NativeApplication.nativeApplication.autoExit = false; 
    var iconLoad = new air.Loader(); 
    var iconMenu = new air.NativeMenu(); 
    var exitCommand = iconMenu.addItem(new air.NativeMenuItem("Exit")); 
    exitCommand.addEventListener(air.Event.SELECT,function(event){ 
            air.NativeApplication.nativeApplication.icon.bitmaps = []; 
            air.NativeApplication.nativeApplication.exit(); 
    }); 

    if (air.NativeApplication.supportsSystemTrayIcon) { 
        air.NativeApplication.nativeApplication.autoExit = false; 
        iconLoad.contentLoaderInfo.addEventListener(air.Event.COMPLETE,iconLoadComplete); 
        iconLoad.load(new air.URLRequest("icons/AIRApp_16.png")); 
        air.NativeApplication.nativeApplication.icon.tooltip = "AIR application"; 
        air.NativeApplication.nativeApplication.icon.menu = iconMenu; 
    } 

    if (air.NativeApplication.supportsDockIcon) { 
        iconLoad.contentLoaderInfo.addEventListener(air.Event.COMPLETE,iconLoadComplete); 
        iconLoad.load(new air.URLRequest("icons/AIRApp_128.png")); 
        air.NativeApplication.nativeApplication.icon.menu = iconMenu; 
    } 

</script> 
</head> 
<body> 
</body> 
</html>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文