c# - Can I cancel selecting text in console? -


i'm making console application in c# , wonder if it's possible disable selecting text while holding shift , pressing arrows.

i tried using console.cancelkeypress doesn't work in case.

try use these methods:

[dllimport("user32.dll", charset = charset.auto, setlasterror = true)] private static extern intptr setwindowshookex(int idhook,     lowlevelkeyboardproc lpfn, intptr hmod, uint dwthreadid);  [dllimport("user32.dll", charset = charset.auto, setlasterror = true)] [return: marshalas(unmanagedtype.bool)] private static extern bool unhookwindowshookex(intptr hhk); 

and in hook method:

private static intptr hookcb(int ncode, intptr wparam, intptr lparam) {     if (ncode >= 0 && wparam == (intptr)wm_keydown)     {         int keycode = marshal.readint32(lparam);                 string keyname = ((keys)keycode).tostring();           //there can define  key pressed , react accordingly     }} 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -