private void SetThreadPriority(ThreadPriorityLevel priority) { try { int tid = int.Parse(listThreads.SelectedItems[0].SubItems[0].Text); using (var thandle = new ThreadHandle(tid, OSVersion.MinThreadSetInfoAccess)) thandle.SetBasePriorityWin32(priority); } catch (Exception ex) { PhUtils.ShowException("Unable to set the priority of the thread", ex); } }