예제 #1
0
        protected override void OnShown(EventArgs e)
        {
            NativeMethods.SetThreadPriority(NativeMethods.GetCurrentThread(), ThreadPriority.THREAD_PRIORITY_HIGHEST);

            try
            {
                CurrentProcess.AdjustPrivileges(SecurityEntiryNames.SE_INC_BASE_PRIORITY_NAME, PrivilegeAction.Enable);
            }
            catch (Exception exception)
            {
                MessageBox.Show(this,
                                "REALTIME_PRIORITY_CLASS will not be available!"
                                + Environment.NewLine + Environment.NewLine
                                + "Probably u r not an administrator or just UAC active. Try right click then and run as administrator."
                                + Environment.NewLine + Environment.NewLine
                                + exception.Message,
                                ":(",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Hand);
            }

            base.OnShown(e);
        }