private void menuOpenDatabase_Click(object sender, EventArgs e) { if (GlobalData.DataRowIndex > 0) { try { DataOperate.UpdateTestData(); NewTestData(); GlobalData.DataRowIndex = 0; } catch (Exception err) { GlobalData.frmStatus.WriteLog("menuOpenDatabase_Click: " + err.Message, false); } } // ShellExecute(this.Handle, new StringBuilder("Open"), new StringBuilder("SDAFDataBase.exe"), new StringBuilder(""), new StringBuilder(Application.StartupPath), 1); try { GlobalData.frmStatus.WriteLog(Properties.Resources.LogOpenDataBase); Process[] p = System.Diagnostics.Process.GetProcessesByName("SDAF.DataBase"); if (p.Length == 0 && File.Exists(Application.StartupPath + @"\SDAF.DataBase.exe")) { System.Diagnostics.Process.Start(Application.StartupPath + @"\SDAF.DataBase.exe"); } else if (p.Length > 0) { StringBuilder Str = new StringBuilder(Properties.Resources.DataBaseName); IntPtr hWnd = WindowsDll.FindWindow(null, Str); if (hWnd != null) { WindowsDll.SendMessage(hWnd, 0x500, 0, 0); } } } catch { return; } }
private void btnPasswordOK_Click(object sender, EventArgs e) { if (!PassTxt3.Enabled) { return; } if (PassTxt1.Text == GlobalCofigData.SystemConfig.PassWord) { if (PassTxt2.Text == PassTxt3.Text) { GlobalCofigData.SystemConfig.PassWord = PassTxt3.Text; Microsoft.Win32.Registry.SetValue(@"HKEY_LOCAL_MACHINE\Software\Sundy\SDAF", @"PassWord", GlobalCofigData.SystemConfig.PassWord); StringBuilder Str = new StringBuilder(Properties.Resources.DataBaseName); IntPtr hWnd = WindowsDll.FindWindow(null, Str); if (hWnd != null) { WindowsDll.SendMessage(hWnd, 0x501, 0, 0);//通知数据库更新密码 } // PasswordClear(); label33.Text = "密码修改成功!"; //(String)configureResources.GetObject("label33.Text"); label33.Visible = true; } else { //"密码确认错误!"; label33.Text = Properties.Resources.NewPasswordErr; label33.Visible = true; // PasswordClear(); PassTxt3.Focus(); } } else { //"原密码输入错误!"; label33.Text = Properties.Resources.OldPasswordErr; label33.Visible = true; // PasswordClear(); PassTxt1.Focus(); } }