论坛里面装不了,代码在这里:
http://blog.csdn.net/labilaoxin/article/details/7004524现在2个问题:
1、内存占用过高。启动后15M左右,然后慢慢增加到70M左右,好像是系统的自动资源回收,才又回到15M,如此往返。2、开机启动老是不成功,不知道是不是要依存与其他服务?想请高手帮忙优化优化,万分感谢!
有好的意见均给分。一贴不够再发2贴!

解决方案 »

  1.   

    内存70M不算多了,只要没有内存泄露即可
    .net很好会出现内存泄露,但是要注意些非托管资源要及时释放,基本上所有实现IDisposable的就要dispose即可。
      

  2.   

    设置服务启动 依赖于其它服务http://zhidao.baidu.com/question/157308764.html?push=ql不过我也不知道拨号依赖于什么其它服务。
      

  3.   


    class BoHao  
        {  
            private static Mutex mutex = new Mutex();  
            private Process dailer = new Process();  
            public int Desc;  
            string EntryName = "宽带连接";  
            string user = "lanxxxxxxxxxx";  
            string pwd = "********";  
            [DllImport("wininet.dll")]  
            private extern static bool InternetGetConnectedState(out int Description, int ReservedValue);  
            // 返回18失败,返回81成功  
            public int IsConnectedToInternet()  
            {  
                InternetGetConnectedState(out Desc, 0);  
                return Desc;  
            }  
      
            public void StartDailer()  
            {  
                try  
                {  
                    if (!IsAlive("rasdial"))  
                    {  
                        mutex.WaitOne();  
                        dailer.StartInfo.FileName = "rasdial.exe";  
                        dailer.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;  
                        dailer.StartInfo.Arguments = EntryName + " " + user + " " + pwd;  
                        dailer.Start();  
                        mutex.ReleaseMutex();  
                    }  
      
                }  
                catch (Exception ee)  
                {  
                    ee.ToString();  
                }  
                finally  
                {  
      
                }  
                dailer.Close();  
            }  
      
      
            private bool IsAlive(string name)  
            {  
                Process[] ps = Process.GetProcessesByName(name);  
                if (ps.Length > 0)  
                {  
                    return true;  
                }  
                else  
                {  
                    return false;  
                }  
            }  
        }  
      

  4.   

    找到了,是rasdial.exe看了下自动启动的服务,哪个都不像。不行的话,Timer做个计数,前几次忽略,不做任何事情。
      

  5.   

    我google的结果很多都是在服务里拨vpn的号,我电脑里有VPN的服务。你看看你的电脑里是不是有何 宽带连接 相关的服务。