Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

disable quickedit c#

using System;
using System.Runtime.InteropServices;

static class DisableConsoleQuickEdit {

   const uint ENABLE_QUICK_EDIT = 0x0040;

   // STD_INPUT_HANDLE (DWORD): -10 is the standard input device.
   const int STD_INPUT_HANDLE = -10;

   [DllImport("kernel32.dll", SetLastError = true)]
   static extern IntPtr GetStdHandle(int nStdHandle);

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

   [DllImport("kernel32.dll")]
   static extern bool SetConsoleMode(IntPtr hConsoleHandle, uint dwMode);

   internal static bool Go() {

      IntPtr consoleHandle = GetStdHandle(STD_INPUT_HANDLE);

      // get current console mode
      uint consoleMode;
      if (!GetConsoleMode(consoleHandle, out consoleMode)) {
         // ERROR: Unable to get console mode.
         return false;
      }

      // Clear the quick edit bit in the mode flags
      consoleMode &= ~ENABLE_QUICK_EDIT;

      // set the new mode
      if (!SetConsoleMode(consoleHandle, consoleMode)) {
         // ERROR: Unable to set console mode
         return false;
      }

      return true;
   }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# uint 
Csharp :: c# formula from string 
Csharp :: activeNetworkInfo depricated 
Csharp :: Request ID: XPBBR4XG1UWuX6fWF08_-jzYkrommVJjO7Os50CTYuZmiw7kMsFUkw== 
Csharp :: C# system dont let write txt file 
Csharp :: how to seperate front of decimal and back of decimal in C# 
Csharp :: AR light estimation Unity 
Csharp :: asp.net core relative file path within console app 
Csharp :: Unity Wait Time Fixed 
Csharp :: c# default parameter 
Csharp :: How to keep line breaks in SQL Server using ASP.NET and C#? 
Csharp :: how to add serilog to your asp.net project 
Csharp :: expander vertical wpf 
Csharp :: how to save in mongo different name field than model? c# 
Csharp :: unity 3d fire shoting 
Csharp :: retrive the last record dynamics 365 by c# 
Csharp :: string extentions not working 
Csharp :: add file to combobox c# 
Csharp :: version string c# 
Csharp :: range to 01 
Csharp :: c# custom comment tags 
Csharp :: como ordenar dados na gridview c# 
Csharp :: c# restore form 
Csharp :: telerik mvc grid required field 
Csharp :: how to make dobuble jump unity 2d 
Csharp :: oldest living language 
Csharp :: grab reference from method parameter c# 
Csharp :: get access to all controls with a specific tag in C# 
Csharp :: Named Entity Extraction C# 
Csharp :: how to write an if statement with two checkboxes in c# 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =