用于窗口服务的NotifyIcon [英] NotifyIcon for Window Service

查看:119
本文介绍了用于窗口服务的NotifyIcon的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以帮助
我已经为Windows服务创建了NotifyIcon.启动服务时,NotifyIcon不会显示在任务栏中.

我已经尝试过在Windos Service中执行以下代码.

Can Any one Help
I have created NotifyIcon for Window Service. When I started the service,the NotifyIcon does not display in task bar.

I have tried following code in Windos Service.

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace ConsoleApplication4
{
    class Program
    {
        private static System.Windows.Forms.NotifyIcon notifyIcon1;
        static void Main(string[] args)
        {
            notifyIcon1 = new System.Windows.Forms.NotifyIcon();
            notifyIcon1.BalloonTipTitle = "PriceLinkService Status";
            notifyIcon1.Text = "PriceLinkService Started \n" + DateTime.Now;
            notifyIcon1.BalloonTipText = "PriceLinkService Started \n" + DateTime.Now; ;
            notifyIcon1.Icon = new Icon("D:\\test.ico");
            notifyIcon1.Visible = true;
            notifyIcon1.ShowBalloonTip(1000);
        }


}
}




}
}



推荐答案

Windows服务无法与用户的桌面通信
Windows service can''t communicate with user''s desktop


这篇关于用于窗口服务的NotifyIcon的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆