- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Windows.Forms;
- namespace Cancel
- {
- static class Program
- {
- /// <summary>
- /// 应用程序的主入口点。
- /// </summary>
- [STAThread]
- static void Main(string[] strArg)
- {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new Form1(strArg));
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Diagnostics;
- namespace Cancel
- {
- public partial class Form1 : Form
- {
- string[] strargs;
- public Form1(string[] strarg)
- {
- InitializeComponent();
- strargs = strarg;
- }
- private void button1_Click(object sender, EventArgs e)
- {
- // MessageBox.Show();
- Process sprs = new Process();
- sprs.StartInfo.FileName = Application.ExecutablePath.Trim();
- sprs.StartInfo.Arguments = "注销回来的";
- sprs.Start();
- Process.GetCurrentProcess().Kill();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- MessageBox.Show(strargs[0]);
- }
- }
- }
---------------方法二
//点击注销按钮事件里面写:
if
(MessageBox.Show(
"您确定要注销登录吗?"
,
"提示"
, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
Application.Exit();
System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location);
}