Search code examples
actionscript-3windows-8gesturescharms-bar

Disable Windows 8 edge gestures/hot corners for multi-touch applications while running in full screen


I have a full screen AS3 game maby with Adobe AIR that runs in Windows 7. In this game it may not be easy to exit (think about kiosk mode, only exit by pressing esc and enter a password).

Now I want this game to run in Windows 8. The game is working like expected but the anoying things are these edge gestures/hot corners (left, top, right, bottom) and the shortcuts.

I've read articles but none helped me. People talk about registery edits, but I dont get this working + the user needs to restart his/hers computer.

I want to open my game, turn off gestures/hot corners and when the game closes the gestures/hot corners need to come back available again.

I have seen some applications doing the same what I want to accomplish.

I found this so I am able to detect the gestures. But how to ignore they're actions?

I also read ASUS Smart Gestures but this is for the touch-pad.

And I have tried Classic Shell but I need to disable the edge gestures/hot corners without such programs, just on-the-fly.

I also found this but I don't know how to implement this.

HRESULT SetTouchDisableProperty(HWND hwnd, BOOL fDisableTouch)
{
    IPropertyStore* pPropStore;
    HRESULT hrReturnValue = SHGetPropertyStoreForWindow(hwnd, IID_PPV_ARGS(&pPropStore));
    if (SUCCEEDED(hrReturnValue))
    {
        PROPVARIANT var;
        var.vt = VT_BOOL;
        var.boolVal = fDisableTouch ? VARIANT_TRUE : VARIANT_FALSE;
        hrReturnValue = pPropStore->SetValue(PKEY_EdgeGesture_DisableTouchWhenFullscreen, var);
        pPropStore->Release();
    }
    return hrReturnValue;
}

Does anyone know how I can do this? Or point me into the right direction?

I have tried some in C# and C++, but I aint a skilled C#/C++ developer. Also the game is made in AS3 so it will be hard to implement this in C#/C++.

I work on the Lenovo aio (All in one) with Windows 8.


Solution

  • I'm trying to do the same thing. The C++ below disables Win8 Gestures on every running application/window. As JonoRR mentioned, the next step would be calling it only on the HWND you would like to target. If the targeted application is closed, then re-opened, the gestures will return.

    #include "stdafx.h"
    #include <windows.h>
    #include <iostream>
    #include <propsys.h>
    #include <propkey.h>
    
    using namespace std;
    
    HWND windowHandle;
    
    HRESULT SetTouchDisableProperty(HWND hwnd, BOOL fDisableTouch)
    {
        IPropertyStore* pPropStore;
        HRESULT hrReturnValue = SHGetPropertyStoreForWindow(hwnd, IID_PPV_ARGS(&pPropStore));
        if (SUCCEEDED(hrReturnValue))
        {
            PROPVARIANT var;
            var.vt = VT_BOOL;
            var.boolVal = fDisableTouch ? VARIANT_TRUE : VARIANT_FALSE;
            hrReturnValue = pPropStore->SetValue(PKEY_EdgeGesture_DisableTouchWhenFullscreen, var);
            pPropStore->Release();
        }
        return hrReturnValue;
    }
    
    BOOL CALLBACK MyEnumProc(HWND hWnd, LPARAM lParam)
    {
        TCHAR title[500];
        ZeroMemory(title, sizeof(title));    
    
        GetWindowText(hWnd, title, sizeof(title)/sizeof(title[0]));
        SetTouchDisableProperty(hWnd,true);
    
        _tprintf(_T("Value is %s\n"), title);
    
        return TRUE;
    }
    
    int _tmain(int argc, _TCHAR* argv[])
    {   
        EnumWindows(MyEnumProc, 0);
        return 0;
    }