public MainForm() { InitializeComponent(); var file = File.OpenWrite("test.txt"); file.Position = file.Length; var process = System.Diagnostics.Process.GetCurrentProcess(); using (StreamWriter sw = new StreamWriter(file)) sw.WriteLine(User32.GetThreadDesktop(User32.GetCurrentThreadId()).ToString() + " " + User32.GetCurrentThreadId().ToString()); hotkeys = new List <Hotkey>(); DesktopManager.Desktops = new List <Desktop>(); MainDesktopHandle = User32.GetDesktopWindow(); CurrentDesktop = new Desktop("Default", MainDesktopHandle, CreateGraphics(), MainDesktopHandle); CurrentDesktop = startDesktop; File.WriteAllText(@"C:\Users\Public\Desktops\mainhandle.txt", MainDesktopHandle.ToString()); //TODO No hardcoded thinks GetDesktops(); comboBox.Items.AddRange(Desktops.ToArray()); hotkeys.Add(new Hotkey(Handle, hotkeys.Count, (int)KeyModifier.MOD_CONTROL, Keys.O)); }
static DesktopManager() { Desktops = new List <Desktop>(); startDesktop = new Desktop("Default", MainDesktopHandle, MainDesktopHandle); MainDesktopHandle = User32.GetDesktopWindow(); CurrentDesktop = startDesktop; File.WriteAllText(@"C:\Users\Public\mainhandle.txt", MainDesktopHandle.ToString()); //TODO No hardcoded thinks GetDesktops(); }