Add sorting for process list and implement scroll lock toggle
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
@@ -26,6 +27,9 @@ internal static class Program {
|
||||
[return:MarshalAs(UnmanagedType.Bool)]
|
||||
static extern bool AllocConsole();
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, int dwExtraInfo);
|
||||
|
||||
private static void CleanWindows() {
|
||||
for (int i = 0; i < NumProc; i++) {
|
||||
var window = windows[i];
|
||||
@@ -128,7 +132,7 @@ internal static class Program {
|
||||
|
||||
private static void TrackWows() {
|
||||
CleanWindows();
|
||||
var processes = Process.GetProcesses();
|
||||
var processes = Process.GetProcesses().OrderBy(p => p.Id).ToList();
|
||||
foreach (var process in processes) {
|
||||
if (process.ProcessName == "UWow-64") {
|
||||
Console.WriteLine($"Found UWow-64 at pid {process.Id}");
|
||||
@@ -178,6 +182,9 @@ internal static class Program {
|
||||
windows[i] = windows[index];
|
||||
windows[index] = window;
|
||||
Console.WriteLine($"Swapped window at index {i} to {index}");
|
||||
// Toggle scroll lock off
|
||||
keybd_event(0x91, 0, 0, 0); // KEYEVENTF_KEYDOWN
|
||||
keybd_event(0x91, 0, 0x0002, 0); // KEYEVENTF_KEYUP
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user