0

I want to disable Touch screen in window 8, but i have some trouble when changed the registry.

After i change registry i must restart the computer. If not restart the computer i can't disable touch screen.But i hope to disable touch screen without restart computer. Here is my code:

int EnableTouchScreen(bool enable)
{
    EnableMulTouch(enable);
    EnableTouch(enable);

    DWORD dwRet = 0;
    SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, NULL, NULL, SMTO_NORMAL,1,&dwRet);

    return 0;
}  

int EnableMulTouch(bool enable) 
{
    HKEY hkey;
    LONG lResult;
    DWORD dwtype; 

    if(IsWin64())
    {
        lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Wisp\\MultiTouch\\"), 0, KEY_WOW64_64KEY | KEY_ALL_ACCESS |KEY_WRITE, &hkey);
    }
    else
    {
    lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Wisp\\MultiTouch\\"), 0, KEY_WOW64_32KEY | KEY_ALL_ACCESS |KEY_WRITE, &hkey);
    }

    if (lResult == ERROR_SUCCESS) 
    {
        DWORD value = 0;

        if(enable)
        {
             value = 1;
             lResult = RegSetValueEx(hkey, _T("MultiTouchEnabled"), 0, REG_DWORD, (PBYTE)&value, sizeof(DWORD));
        }
        else
        {
            value = 0;
            lResult = RegSetValueEx(hkey, _T("MultiTouchEnabled"), 0, REG_DWORD, (PBYTE)&value, sizeof(DWORD));
        }

        if (lResult != ERROR_SUCCESS) 
        {
            char strErr[256];
            sprintf(strErr, "SetMulTouch --- GetLastError(): %u\n", GetLastError() );
            OutputDebugStringA(strErr);

            return FALSE;
        }

        RegCloseKey(hkey);
   }

   return 0;
}

int EnableTouch(bool enable)
{
    HKEY hkey;
    LONG lResult; 
    DWORD dwtype; 

    if(IsWin64())
{
    lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Wisp\\Touch\\"), 0, KEY_WOW64_64KEY | KEY_ALL_ACCESS |KEY_WRITE, &hkey);
}
else
{

    lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Wisp\\Touch\\"), 0, KEY_WOW64_32KEY | KEY_ALL_ACCESS |KEY_WRITE, &hkey);
}

if (lResult == ERROR_SUCCESS) 
{
    DWORD value = 0;

    if(enable)
    {
        value = 1;
        lResult = RegSetValueEx(hkey, _T("TouchGate"), 0, REG_DWORD, (PBYTE)&value, sizeof(DWORD));
        value = 0;
        lResult = RegSetValueEx(hkey, _T("PanningDisabled"), 0, REG_DWORD, (PBYTE)&value, sizeof(DWORD));
    }
    else
    {
        value = 0;
        lResult = RegSetValueEx(hkey, _T("TouchGate"), 0, REG_DWORD, (PBYTE)&value, sizeof(DWORD));
        value = 1;
        lResult = RegSetValueEx(hkey, _T("PanningDisabled"), 0, REG_DWORD, (PBYTE)&value, sizeof(DWORD));
    }

    if (lResult != ERROR_SUCCESS) 
    {
        char strErr[256];
        sprintf(strErr, "SetMulTouch --- GetLastError(): %u\n"GetLastError() ); 
        OutputDebugStringA(strErr);
        return FALSE;
    }

    RegCloseKey(hkey);
}

return 0;
 }
Jabberwocky
  • 48,281
  • 17
  • 65
  • 115
user2010407
  • 1
  • 1
  • 1

3 Answers3

0

I don't think this helps program wise, but you can disable / enable the touch screen by short cut in windows 8 using this app.

http://www.nirsoft.net/utils/device_manager_view.html

Download it in your language and you'll have to use console commands after creating a shortcut

  1. Open regular device manager
  2. Locate your touchscreen driver **
  3. Launch device manager you downloaded
  4. Locate the touchscreen driver you want to disable
  5. Properties menu on it
  6. Copy [Device Instance ID] to notepad
  7. Create a shortcut to the device manager you downloaded
  8. Add the following to the end of the target name *
    • /enable "[Device Instance ID]"+
    • /disable "[Device Instance ID]"+

Of course you'll want both so make two shortcuts.

** (it'll be one of the Human Interface Drivers, disable one at a time until you find out which is touch screen if you're unsure, be careful not to disable more than one at a time or risk being locked out of your computer!!)

***don't add the +'s, just whats between them

  • Thank you so much, now i using "devcon.exe" tools to disable all HID,But i don't know whether it will Lead to other problems – user2010407 Oct 24 '13 at 07:46
0

Windows 8.1

  1. I right clicked on "Four Square" icon (used to be Start Button)
  2. Device Manager
  3. N-trig DuoSense(R) Digitizers
  4. Right click "N-trig Duosense Touch HID Interface"
  5. Disable

DONE!

0

Thanks to matscol he answered his own similar question here:

How to turn off all touch input at application, window or control level?

It would still be nice to only disable it at the application level and now system wide like the registry hack does.

I will use this solution for now but I will be looking for something better.

Community
  • 1
  • 1
jaredbaszler
  • 3,941
  • 2
  • 32
  • 40