locked
Toggle Touch Update Not Working In Windows 8 RRS feed

  • Question

  • I am trying to write an c# app that will toggle touch in Windows 8.  You can manually toggle this by going into the Pen & touch settings in the control panel and unchecking "Use your finger as an input device"

    Essentially all this does is update the following registery value:

    HKEY_CURRENT_USER\Software\Microsoft\Wisp\Touch

    This is the easy part.  If I change this value from 1 to 0 and the log off and then back on.  Touch input is disabled.  What I can't get working doing this without logging on and off.

    I am using this code:

     

     

    internal class User32Utils
        {
            #region USER32 Options
            static IntPtr HWND_BROADCAST = new IntPtr(0xffffL);
            static IntPtr WM_SETTINGCHANGE = new IntPtr(0x1a);
            #endregion
    
            #region STRUCT
            enum SendMessageTimeoutFlags : uint
            {
                SMTO_NORMAL = 0x0000,
                SMTO_BLOCK = 0x0001,
                SMTO_ABORTIFHUNG = 0x2,
                SMTO_NOTIMEOUTIFNOTHUNG = 0x0008
            }
            #endregion
    
            #region Interop
    
            [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
            static extern IntPtr SendMessageTimeout(IntPtr hWnd,
                                                    uint Msg,
                                                    UIntPtr wParam,
                                                    UIntPtr lParam,
                                                    SendMessageTimeoutFlags fuFlags,
                                                    uint uTimeout,
                                                    out UIntPtr lpdwResult);
            #endregion
    
            internal static void Notify_SettingChange()
            {
                UIntPtr result;
                SendMessageTimeout(HWND_BROADCAST, (uint)WM_SETTINGCHANGE,
                                   UIntPtr.Zero, UIntPtr.Zero,
                                    SendMessageTimeoutFlags.SMTO_NORMAL, 1000, out result);
            }
        }
    }
    

     


    to do the toggling.   This works fine in Windows 7 but does nothing in Windows 8.  The registry value changes but nothing takes effect until I log off.

     

    Does anyone have any idea why this is happening and what I might do to force update the registry value?

     

    Thanks


    • Edited by jocose Saturday, January 7, 2012 4:43 AM
    Saturday, January 7, 2012 4:41 AM

Answers

  • This is a user setting. There is no programmatic access to this.

    Mucking with undocumented registry keys is not supported and while it may work in some situations it is not guaranteed to do what you want and may change without notice. This is definitely not something you would want to do in production code.

    Also, this forum is about writing Metro style apps. Discussion of writing desktop apps should go to the Windows Desktop Development forums.

    --Rob

    Saturday, January 7, 2012 4:52 AM
    Moderator

All replies

  • This is a user setting. There is no programmatic access to this.

    Mucking with undocumented registry keys is not supported and while it may work in some situations it is not guaranteed to do what you want and may change without notice. This is definitely not something you would want to do in production code.

    Also, this forum is about writing Metro style apps. Discussion of writing desktop apps should go to the Windows Desktop Development forums.

    --Rob

    Saturday, January 7, 2012 4:52 AM
    Moderator
  • This is a personal tool meant for myself and a few others who need to disable touch input dynamically because it conflicts with several art applications we use.  It wont be used in production and as far as I know there is no other way to do this.

     

    Also, my apologies for posting here.  Its a windows 8 specific issue.  I thought this forum might be relevent because of that but I see other windows 8 posts in the forum you linked to.  I will post there.

     

    If any mods want to delete this post feel free.

    Saturday, January 7, 2012 5:54 AM