public SRECForm(string[] args) { if (args[0] == "-r32Plugin" && Administrator.IsAdministrator()) { Regsvr32Plugin.ScreenCaptureRecorder(); // 注册插件 InitializeComponent(); } else { isRestartOrQuit = true; Application.Exit(); } }
private void InstallPluginButton_Click(object sender, EventArgs e) { if (Administrator.IsAdministrator() == false) { ProcessStartInfo restartApplication = new ProcessStartInfo(Application.ExecutablePath); restartApplication.Arguments = "-r32Plugin"; restartApplication.Verb = "runas"; try { Process.Start(restartApplication); isRestartOrQuit = true; Application.Exit(); } catch { } } else { // 注册ScreenCaptureRecorder插件 Regsvr32Plugin.ScreenCaptureRecorder(); InstallPluginButton.Enabled = !(Settings.Default.inputDevice == "dshow"); } }
private void ScreenCaptureRecorderToolStripMenuItem_Click(object sender, EventArgs e) { if (IsAdministrator() == false) { ProcessStartInfo restartApplication = new ProcessStartInfo(Application.ExecutablePath); restartApplication.Arguments = "-r32Plugin"; restartApplication.Verb = "runas"; try { Process.Start(restartApplication); isRestartOrQuit = true; Application.Exit(); } catch { } } else { Regsvr32Plugin.ScreenCaptureRecorder(); ScreenCaptureRecorderToolStripMenuItem.Checked = (Settings.Default.inputDevice == "dshow"); } }