Console selection stops application
<p>I'm running a socket server on my server and I woke up to numerous messages about its inaccessibility. It turns out that before I went to bed, I had highlighted an IP address in the window and forgot to hit Enter to resume the process.</p>

<p>This is how I disable selection in the console, now, but I still want to be able to select without the application pausing.</p>

<pre><code>    #region Disable Quick-Edit Mode
    [DllImport("kernel32.dll")]
    static extern bool SetConsoleMode(IntPtr hConsoleHandle, int mode);

    [DllImport("kernel32.dll")]
    static extern bool GetConsoleMode(IntPtr hConsoleHandle, out int mode);

    [DllImport("kernel32.dll")]
    static extern IntPtr GetStdHandle(int handle);

    const int STD_INPUT_HANDLE = -10;
    const int ENABLE_EXTENDED_FLAGS = 0x80;

    public static void DisableQuickEditMode()
    {
        int mode;
        IntPtr handle = GetStdHandle(STD_INPUT_HANDLE);
        GetConsoleMode(handle, out mode);
        mode |= ENABLE_EXTENDED_FLAGS;
        SetConsoleMode(handle, mode);
        mode &amp;= ~ENABLE_QUICK_EDIT;
        SetConsoleMode(handle, mode);
    }
</code></pre>

<p>I really don't want to go back to the Legacy Mode of Command Prompt, because it really does help to have these new features (especially for devs), but I need to find a way to prevent the application from stopping when I pause the console. 
What's interesting is that when I hit Enter this morning, all of the connections that had been attempted were processed, and then after they were processed, they were dropped. Which makes me wonder if, perhaps, I'm writing the application wrong; that I need to have a "Console" thread and a "Server" thread. But I'm not sure that could even make a difference.</p>