老大,可不可以给点资料,有关服务程序和多线呈怎么写?
多多地谢啊啊!!
xupc(寻巢鸟) ,我跟你混啊。

解决方案 »

  1.   

    给你一个线程操作的例子,关于服务程序,就随便把窗口隐藏一下算了,省事,嘿嘿
    private void StartBtn_OnClick(object sender, System.EventArgs e)
    {

    this.LastTime =DateTime.Now;
    System.Threading.ThreadStart threadStart =new System.Threading.ThreadStart(Thread);
    System.Threading.Thread thread =new System.Threading.Thread(threadStart);
    thread.IsBackground =true;
    thread.Start();
    this.notifyIcon1.Text ="数据发送驻留程序-已启动";
    this.button1.Enabled =false; }
    /// <summary>
    /// 线程中检测时间
    /// </summary>
    private void Thread()
    {
    while(true)
    {
    System.TimeSpan ts =new TimeSpan(0,0,int.Parse(this.DBFTime),0,0);
    DateTime DBFDateTime =this.LastTime+ts;
    DateTime TXTDateTime =DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")+" "+this.TXTTime);
    DateTime NowDateTime =DateTime.Now;
    if (NowDateTime.ToString()==DBFDateTime.ToString())
    {
    this.InserDBFData();
    this.UpLoadFile();
    this.InsertFromExcel();
    // this.Up701Data();
    this.LastTime =DBFDateTime;
    }
    /*
    if (NowDateTime.ToString() ==TXTDateTime.ToString())
    {
    this.UpLoadFile();//其他调用方法
    this.InsertFromExcel();//其他调用方法
    this.InserDBFData();//其他调用方法
    }
    */
    System.Threading.Thread.Sleep(200);
    }
    }
      

  2.   

    程序搞好了。但是。。我是用一个窗体,然后在上面放了一个按钮,点击按钮,运行线程,隐掉窗体,每隔10分钟测一下数据库。但是,关闭程序的时候必须要通过任务管理器。。很郁闷,如何能把它做成象qq那样可以最小化到右下角的呢??
    另一个小问题,我的win2kprofessional,发现一个非常讨厌的问题
    ctrl+alt+del,再按任务管理器,出现一个没有最大化,最小化和关闭按钮的窗口,也没有程序和性能的选项卡,只能显示进程,每次都要用alt+f4才能关闭,非常可恶,该怎么办呢?
      

  3.   

    用trayicon就ok,看一下msdn范例,很简单的双击任务管理器中间,呵呵
      

  4.   

    “双击任务栏中间”----多多地谢iamcj朋友