Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions MainV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -879,8 +879,8 @@ public MainV2()
}
else
{
int win = NativeMethods.FindWindow("ConsoleWindowClass", null);
NativeMethods.ShowWindow(win, NativeMethods.SW_HIDE); // hide window
NativeMethods.ShowWindow(NativeMethods.GetConsoleWindow(), NativeMethods.SW_HIDE);

}

// prevent system from sleeping while mp open
Expand Down
6 changes: 5 additions & 1 deletion NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ internal static class NativeMethods
public static extern int FindWindow(string szClass, string szTitle);

[DllImport("user32.dll")]
public static extern int ShowWindow(int Handle, int showState);
public static extern bool ShowWindow(IntPtr Handle, int showState);

[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
internal static extern IntPtr RegisterDeviceNotification
(IntPtr hRecipient,
IntPtr NotificationFilter,
Int32 Flags);


[DllImport("kernel32.dll")]
public static extern IntPtr GetConsoleWindow();

// Import SetThreadExecutionState Win32 API and necessary flags

[DllImport("kernel32.dll")]
Expand Down