How do I disable edge gestures when my window is full screen?

Raymond Chen

A customer wanted to disable edge gestures when their program is running full screen. For example, you may want to do this if you are something like the Remote Desktop client, where you want all input (including the edge gestures) to be sent to the remote computer.

Fortunately, there’s a property specifically designed for what you request. It goes by the devious name System.Edge­Gesture.Disable­Touch­When­Fullscreen.

Let’s take it for a spin. Today’s smart pointer library will be (rolls dice) Nothing! We’re going with raw pointers today.

Start with the scratch program and make these changes:

#include <propsys.h>
#include <shellapi.h>
#include <propkey.h>
OnCreate(HWND hwnd, LPCREATESTRUCT lpcs)
  SetTouchDisableProperty(hwnd, true);
  return 1;

This Set­Touch­Disable­Property helper function sets the property on the window’s property store which says whether we want to disable touch edge gestures when the window is full screen. We set that property when we create the window.

void OnChar(HWND hwnd, TCHAR ch, int cRepeat)
  if (ch == '1') {
    HMONITOR hmon = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
    MONITORINFO mi = { sizeof(mi) };
    GetMonitorInfo(hmon, &mi);
    SetWindowPos(hwnd, nullptr,
        mi.rcMonitor.right - mi.rcMonitor.left, mi.rcMonitor.bottom -,

  HANDLE_MSG(hwnd, WM_CHAR, OnChar);

When the user hits the 1 key, we go full screen by changing our style to WS_POPUP­WINDOW and changing our window size to match the monitor the window is on.

Okay, now take this program for a spin. It starts out in a normal non-fullscreen mode. Edge gestures are still active. Then press 1 to go full screen. Now edge gestures are inactive.

That’s all.


Discussion is closed.

Feedback usabilla icon