public partial class frmYbCheckIn : Form { string[] args = null; public frmYbCheckIn() { InitializeComponent(); } public frmYbCheckIn(string[] args) { InitializeComponent(); this.args = args; } }
/* /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmYbCheckIn()); }*/ /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (args.Length == 0) Application.Run(new frmYbCheckIn()); else Application.Run(new frmYbCheckIn(args)); }
private void frmYbCheckIn_Load(object sender, EventArgs e) { /* */ // run xx.exe p1 p2 "p3|p3" // here get p1 p2 "p3|p3" // parse parameter // public string InsuIPReg(int dHandle, string UserId, string PaadmRowid, string AdmReasonNationCode, // string AdmReasonId, string ExpStr); if (args!=null && args.Length >= 6) { dHandle = int.Parse(args[0]); UserId = args[1]; PaadmRowid = args[2]; AdmReasonNationCode = args[3]; AdmReasonId = args[4]; ExpStr = args[5]; string strInput; strInput = string.Format("dHandle={0} UserId={1} PaadmRowid={2} AdmReasonNationCode={3} AdmReasonId={4} ExpStr={5}", dHandle, UserId, PaadmRowid, AdmReasonNationCode, AdmReasonId, ExpStr); WriteTxtFile("d:\zydjReq.txt", strInput); } Thread th = new Thread(new ThreadStart(WorkThread)); th.Start(); }