protected override void DefWndProc(ref Message m) { if (m.Msg == (int)Msg.WM_COPYDATA) { COPYDATASTRUCT dataInfo = (COPYDATASTRUCT)m.GetLParam(typeof(COPYDATASTRUCT)); string str = dataInfo.lpData; Type objType = FrmCollection.GetFrmByID(str); if (objType == null) { MessageBox.Show("找不到界面:" + str); return; } Form frm = SingleForms.GetControl(objType) as Form; frm.Show(); } base.DefWndProc(ref m); }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); _config = new ConfigManager(); _config.LoadConfig(); using (FrmMain frm = SingleForms.GetForm <FrmMain>()) { if (args != null && args.Length > 0) { foreach (string arg in args) { if (arg.Equals("-s", StringComparison.CurrentCultureIgnoreCase)) { frm.AutoStart = true; } } } Application.Run(frm); } }