用c#.NET做的托盘程序,在关机时由于该托盘的存在,计算机不能关机或重起。谁知道是什么原因?如何处理?

解决方案 »

  1.   

    以前做过一个类似的:
    http://blog.csdn.net/chengking/archive/2005/12/24/561259.aspx
      

  2.   

    http://blog.csdn.net/chengking/archive/2005/12/24/561259.aspx
    打不开呀
      

  3.   

    如果你在程序中,没有强制不能关机的代码,
    那么最大的原因是你没有结束你的线程,你可以捕捉到Windows的关键事件,在这个时候你结束你的应用程序,并推出所有的线cheng,
    这可以解决你的问题
      

  4.   

    谢谢mythofcynthia(Blue) ( ) 信誉:100    Blog 
    那么关机的关键事件是什么呢?
      

  5.   

    这个问题怎么又被翻出来了?
    在Windows程序中主线程中加上
            const int WM_QUERYENDSESSION = 0x0011;
            protected override void WndProc(ref Message m)
            {
                switch (m.Msg)
                {                case WM_QUERYENDSESSION:
                        //在这里处理你的资源和线程,让他们全部退出                    
                        ReleaseResource();
                        this.Close();
                        this.Dispose();
                        Application.Exit();                    //m.Result = (IntPtr)0;
                        break;
                    default:
                        break;
                }
               base.WndProc(ref m);
           }