/// <summary>
 /// 设置输入参数个数
 /// </summary>
 /// <param name="strEntryName">条目名称</param>
 /// <param name="strPhoneNumber">电话号码</param>
 /// <param name="strUserName">用户名</param>
 /// <param name="strPassword">密码</param>
 /// <param name="bRememberPassword">记住密码</param>
 /// <param name="strError">错误</param>
 /// <returns>结果</returns>
 public bool SetEntryParams(string strEntryName, string strPhoneNumber, string strUserName, string strPassword, bool bRememberPassword, out string strError)
 {
     TmphRASDIALPARAMS structure = new TmphRASDIALPARAMS();
     structure.dwSize = Marshal.SizeOf(structure);
     structure.szEntryName = strEntryName;
     structure.szPhoneNumber = strPhoneNumber;
     structure.szUserName = strUserName;
     structure.szPassword = strPassword;
     int nErrorValue = RasSetEntryDialParams(null, ref structure, !bRememberPassword);
     if (nErrorValue != 0)
     {
         strError = this.GetErrorString(nErrorValue);
         return false;
     }
     strError = null;
     return true;
 }
 private static extern int RasDial(int lpRasDialExtensions, string lpszPhonebook, ref TmphRASDIALPARAMS lpRasDialParams, int dwNotifierType, TmphRasDialEvent lpvNotifier, ref int lphRasConn);
 private static extern int RasSetEntryDialParams(string lpszPhonebook, ref TmphRASDIALPARAMS lprasdialparams, bool fRemovePassword);
 /// <summary>
 /// 拨号
 /// </summary>
 /// <param name="strEntryName">条目名称</param>
 /// <param name="strError">错误</param>
 /// <returns>结果</returns>
 public bool DialUp(string strEntryName, out string strError)
 {
     bool lpfPassword = false;
     TmphRASDIALPARAMS structure = new TmphRASDIALPARAMS();
     structure.dwSize = Marshal.SizeOf(structure);
     structure.szEntryName = strEntryName;
     TmphRasDialEvent lpvNotifier = new TmphRasDialEvent(this.RasDialFunc);
     int nErrorValue = RasGetEntryDialParams(null, ref structure, ref lpfPassword);
     if (nErrorValue != 0)
     {
         strError = this.GetErrorString(nErrorValue);
         return false;
     }
     this.ConnectNotify("正在连接" + structure.szEntryName + "...", 1);
     this.EntryName = strEntryName;
     this.hrasconn = 0;
     nErrorValue = RasDial(0, null, ref structure, 0, lpvNotifier, ref this.hrasconn);
     if (nErrorValue != 0)
     {
         strError = this.GetErrorString(nErrorValue);
         this.ConnectNotify(strError, 3);
         return false;
     }
     this.ConnectNotify("正在打开端口...", 1);
     strError = null;
     return true;
 }