private void Before_MainFormClose(object sender, FormClosingEventArgs e) { if (!Backgrounding.Checked) { if (MessageBox.Show("프로그램을 종료하시겠습니까? ", "종료 확인", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No) { e.Cancel = true; } else { ProtectedProcess.Unprotect(); Application.ExitThread(); Environment.Exit(0); } } else if (PasswordRequired.Checked && PasswordBox.Text.Length == 0) { MessageBox.Show("암호란이 공백입니다. ", "암호 입력 필요", MessageBoxButtons.OK, MessageBoxIcon.Warning); e.Cancel = true; } else { Hide(); PasswordBox.Text = GetPassword; SetPassword.Enabled = false; e.Cancel = true; } }
private void PasswordCheck(object sender, EventArgs e) { if (GetPassword == passwordForm.TypedPassword && !passwordForm.Visible) { if (OpenForm) { Show(); OpenForm = false; } else if (CloseForm) { if (MessageBox.Show("프로그램을 종료하시겠습니까? ", "종료 확인", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No) { CloseForm = false; } else { ProtectedProcess.Unprotect(); Application.ExitThread(); Environment.Exit(0); } } } }
private void 종료ToolStripMenuItem_Click(object sender, EventArgs e) { if (PasswordRequired.Checked) { CloseForm = true; if (!Visible) { passwordForm.Show(); } else { if (MessageBox.Show("프로그램을 종료하시겠습니까? ", "종료 확인", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { ProtectedProcess.Unprotect(); Application.ExitThread(); Environment.Exit(0); } } } else { if (MessageBox.Show("프로그램을 종료하시겠습니까? ", "종료 확인", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { ProtectedProcess.Unprotect(); Application.ExitThread(); Environment.Exit(0); } } }
static void Main() { ProtectedProcess.Protect(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); }
private void After_MainFormClose(object sender, FormClosedEventArgs e) { if (!Backgrounding.Checked) { ProtectedProcess.Unprotect(); Application.ExitThread(); Environment.Exit(0); } }