Disable Action Center

Hi does anyone have any idea if it is possible and how to stop windows showing the Action Center when swiping in from right? Same for the select application view you get when swiping from left. Top and bottom swipe in’s do nothing, as far as i know.

Want i would what is while an application is running in full screen these features are disabled. Once app is closed it reverts back to defaults.

something like supporting these feature

https://docs.microsoft.com/en-us/uwp/api/windows.ui.viewmanagement.applicationview#Windows_UI_ViewManagement_ApplicationView_FullScreenSystemOverlayMode

Cheers

https://stackoverflow.com/questions/19889683/how-do-i-turn-off-windows-8-1-gestures-and-setting-charm-bar-on-my-touch-screen

Its doable, but it might be easier/worth an email/message to Christian Schmitz to see if he can add it to MBS Win :slight_smile:

Here you go, I put together a small DLL that just services this one call (I had a little help on another forum).

Its using SHGetPropertyStoreForWindow and is setting the value of System.EdgeGesture.DisableTouchWhenFullscreen

This will only work if you have a full screen window (see demo).

https://www.dropbox.com/s/vghtuen7nbjxnyr/DisableTouchWhenFullscreen.zip?dl=1

Here’s the source if you want to tweak it or build your own if you dont trust DLLs from the interwebs :slight_smile:

https://github.com/JulianSamphire/DisableTouchWhenFullscreen

PS This is only a 32bit library, I dont know how this will behave in 64bit Xojo, let me know if you need that and I’ll have a play.

Hey Julian that worked perfectly on win32, i will need to build as 64bit.

Would be good to get Christian to add to his librarys.

Just in case you use it i wrote this code to remove borders from windows, seems to work a lot better than Christian’s logic on all window types and platforms.

Public Sub RemoveWindowFrame(extends window as window)
  #if TargetWin32 then
    Const SWP_NOMOVE        = &H2
    Const SWP_FRAMECHANGED  = &H20
    const SWP_NOSIZE        = &h0001
    const SWP_DRAWFRAME     = &h0020
    const SWP_NOZORDER      = &h0004
    const SWP_NOOWNERZORDER = &h0200
    
    Const HWND_TOPMOST   = -1
    Const GWL_STYLE      = -16
    const GWL_EXSTYLE    = -20
    
    const WS_OVERLAPPED    = &h00000000
    const WS_POPUP         = &h80000000
    const WS_CHILD         = &h40000000
    const WS_MINIMIZE      = &h20000000
    const WS_VISIBLE       = &h10000000
    const WS_DISABLED      = &h08000000
    const WS_CLIPSIBLINGS  = &h04000000
    const WS_CLIPCHILDREN  = &h02000000
    const WS_MAXIMIZE      = &h01000000
    const WS_CAPTION       = &h00C00000     ' WS_BORDER | WS_DLGFRAME 
    const WS_BORDER        = &h00800000
    const WS_DLGFRAME      = &h00400000
    const WS_VSCROLL       = &h00200000
    const WS_HSCROLL       = &h00100000
    const WS_SYSMENU       = &h00080000
    const WS_THICKFRAME    = &h00040000
    const WS_GROUP         = &h00020000
    const WS_TABSTOP       = &h00010000
    
    const WS_MINIMIZEBOX   = &h00020000
    const WS_MAXIMIZEBOX   = &h00010000
    
    const WS_TILED         = WS_OVERLAPPED
    const WS_ICONIC        = WS_MINIMIZE
    const WS_SIZEBOX       = WS_THICKFRAME
    
    
    // Common Window Styles
    const WS_OVERLAPPEDWINDOW = ( WS_OVERLAPPED  OR WS_CAPTION OR WS_SYSMENU OR WS_THICKFRAME OR WS_MINIMIZEBOX OR WS_MAXIMIZEBOX)
    
    const WS_POPUPWINDOW = ( WS_POPUP or WS_BORDER  or WS_SYSMENU )
    
    const WS_CHILDWINDOW = WS_CHILD
    
    const WS_TILEDWINDOW   = WS_OVERLAPPEDWINDOW
    
    //Extended Window Styles
    
    const WS_EX_DLGMODALFRAME     = &h00000001
    const WS_EX_NOPARENTNOTIFY    = &h00000004
    const WS_EX_TOPMOST           = &h00000008
    const WS_EX_ACCEPTFILES       = &h00000010
    const WS_EX_TRANSPARENT       = &h00000020
    
    
    const WS_EX_MDICHILD          = &h00000040
    const WS_EX_TOOLWINDOW        = &h00000080
    const WS_EX_WINDOWEDGE        = &h00000100
    const WS_EX_CLIENTEDGE        = &h00000200
    const WS_EX_CONTEXTHELP       = &h00000400
    
    const WS_EX_RIGHT             = &h00001000
    const WS_EX_LEFT              = &h00000000
    const WS_EX_RTLREADING        = &h00002000
    const WS_EX_LTRREADING        = &h00000000
    const WS_EX_LEFTSCROLLBAR     = &h00004000
    const WS_EX_RIGHTSCROLLBAR    = &h00000000
    
    const WS_EX_CONTROLPARENT     = &h00010000
    const WS_EX_STATICEDGE        = &h00020000
    const WS_EX_APPWINDOW         = &h00040000
    
    const WS_EX_OVERLAPPEDWINDOW  = (WS_EX_WINDOWEDGE OR WS_EX_CLIENTEDGE)
    const WS_EX_PALETTEWINDOW     = (WS_EX_WINDOWEDGE OR WS_EX_TOOLWINDOW OR WS_EX_TOPMOST)
    
    
    //Windows api function to get current window properties
    Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (hwnd As Integer, nIndex As Integer, dwNewLong As Integer) As Integer
    Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As integer, ByVal nIndex As UInt64) As UInt64
    //windows api function to update window property
    Declare Function SetWindowPos Lib "user32" (hwnd as Integer, hWndInstertAfter as Integer, x as Integer, y as Integer, cx as Integer, cy as Integer, flags as uint64) as uint64
    
    call SetWindowLong(window.Handle, GWL_STYLE, GetWindowLong(window.Handle, GWL_STYLE) AND NOT (WS_CAPTION OR WS_BORDER OR WS_THICKFRAME OR WS_MINIMIZE OR WS_MAXIMIZE OR WS_SYSMENU))
    call SetWindowLong(window.Handle, GWL_EXSTYLE, GetWindowLong(window.Handle, GWL_EXSTYLE) AND NOT (WS_EX_DLGMODALFRAME OR WS_EX_CLIENTEDGE OR WS_EX_STATICEDGE))
    call SetWindowPos(window.Handle, HWND_TOPMOST,0,0,0,0,SWP_FRAMECHANGED OR SWP_NOMOVE OR SWP_NOSIZE)
    
  #endif
End Sub

Nice, I just borrowed Christians code as google was quicker than digging out my implementation, thanks though :slight_smile:

I’ve added the 64bit version to the zip, I tested it in the Microsoft Windows Simulator and it seemed to worked ok.

Hope it helps.

64 bit version works a treat. I will send that code to Christian and ask if he could add it to this windows functions.

Could you upload the 64bit source as well?

Its no different, its just compiled in the 64bit edition of that program I cant mention :slight_smile:

It can probably be done native in Xojo, I just dont want to have to get my head around PROPVARIANT at the moment in Xojo as it uses Unions.

makes sense. Did you see anyway to stop the trailing effecting when using your finger and the square that appears when long pressing (simulating right click) You can turn that off for the pen but could not see anything for your finger.

I think this is the WFP code

PointerVisualizationSettings.GetForCurrentView().IsContactFeedbackEnabled = false;

BOOL fEnabled = FALSE; SetWindowFeedbackSetting(hwnd, FEEDBACK_TOUCH_CONTACTVISUALIZATION, 0, sizeof(fEnabled), &fEnabled);

This is what i am after, should be able to add this easy enough

Using this api function

BOOL WINAPI SetWindowFeedbackSetting(
  _In_           HWND          hwnd,
  _In_           FEEDBACK_TYPE feedback,
  _In_           DWORD         dwFlags,
  _In_           UINT32        size,
  _In_opt_ const VOID          *configuration
);[/code]

[code]typedef enum tagFEEDBACK_TYPE { 
  FEEDBACK_TOUCH_CONTACTVISUALIZATION  = 1,
  FEEDBACK_PEN_BARRELVISUALIZATION     = 2,
  FEEDBACK_PEN_TAP                     = 3,
  FEEDBACK_PEN_DOUBLETAP               = 4,
  FEEDBACK_PEN_PRESSANDHOLD            = 5,
  FEEDBACK_PEN_RIGHTTAP                = 6,
  FEEDBACK_TOUCH_TAP                   = 7,
  FEEDBACK_TOUCH_DOUBLETAP             = 8,
  FEEDBACK_TOUCH_PRESSANDHOLD          = 9,
  FEEDBACK_TOUCH_RIGHTTAP              = 10,
  FEEDBACK_GESTURE_PRESSANDTAP         = 11,
  FEEDBACK_MAX                         = 0xFFFFFFFF
} FEEDBACK_TYPE;

And trying to set Touch contact vis to be false (1) it never seems to return true. Passing in size = 0 and nil to reset works.
Any idea what simple thing i am doing wrong?

[code] Declare Function SetWindowFeedbackSetting Lib “user32.dll” (hwnd As integer, feedback As UInt32, dwFlags as UInt32, size As UInt32, value as ptr) As boolean
dim mb as new MemoryBlock(1)
mb.BooleanValue(0) = false

if SetWindowFeedbackSetting(window1.Handle, 1, 0,mb.Size, mb) then
//Worked
else
//Failed
end if[/code]

See here https://blog./2017/01/22/windows-to-xojo-data-type-conversion/

BOOL in Windows is an Int32 which is 32bits, so it would need to be MemoryBlock(4)

Well of course it is :slight_smile:

Setting all those enums (1 - 11) to false works, clearing it out also works.

That list is very handy

Yeah, I got bored of looking it up all the time. I post a link to it every chance I get :wink:

Ever since I threw this dll together its been bugging me that there wasn’t a native solution in Xojo without using an external DLL, so here you go:

https://www.dropbox.com/s/uzw7qutc5iceten/DisableTouchWhenFullscreen.xojo_binary_project?dl=1

This took me quite a while to figure out, William’s post was crucial in helping me get it working, thanks William.

Next up, playing around with Toast Notifications.

Here’s a copy of the meat and potatoes of the routine (for future search hits).

[code]Public Function DisableTouchWhenFullscreen(Handle As Integer, State As Boolean) as Integer
'Declares made with - https://blog./2017/01/22/windows-to-xojo-data-type-conversion/
'Thanks to William and his post for inspiration - How to Recursively Delete a Folder – Xojo Programming Blog

Dim result As Integer

'http://referencesource.microsoft.com/#PresentationFramework/src/Framework/MS/Internal/AppModel/ComGuids.cs,26
Dim IID_IPropertyStore As MemoryBlock = COM.IIDFromString("{886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99}")

'https://msdn.microsoft.com/en-us/library/windows/desktop/ms678505(v=vs.85).aspx
Const COINIT_APARTMENTTHREADED = &h2
Const COINIT_MULTITHREADED = &h0
Const COINIT_DISABLE_OLE1DDE = &h4
Const COINIT_SPEED_OVER_MEMORY = &h8

'https://msdn.microsoft.com/en-us/library/windows/desktop/ff485842(v=vs.85).aspx
Const S_OK = &h0
Const S_FALSE = &h1
'http://referencesource.microsoft.com/#System.Windows.Forms/winforms/Managed/System/WinForms/NativeMethods.cs,6744d905b2436994
Const RPC_E_CHANGED_MODE = &h80010106

'https://msdn.microsoft.com/en-us/library/windows/desktop/ms695279(v=vs.85).aspx
Declare Function CoInitializeEx Lib “Ole32” (pvReserved As Ptr, dwCoInit As UInt32) As Integer
Dim CoInit As Integer
CoInit = CoInitializeEx(Nil, COINIT_APARTMENTTHREADED Or COINIT_DISABLE_OLE1DDE)

If Coinit = S_OK Or CoInit = S_FALSE Or (CoInit And RPC_E_CHANGED_MODE) = RPC_E_CHANGED_MODE Then

'https://msdn.microsoft.com/en-us/library/windows/desktop/dd378430(v=vs.85).aspx
Declare Function SHGetPropertyStoreForWindow Lib "Shell32" (hwnd As Integer, riid As Ptr, ByRef ppv As Ptr) As Integer

Dim PropertyStore As Ptr
result = SHGetPropertyStoreForWindow(Handle, IID_IPropertyStore, PropertyStore)

If result = S_OK Then
  
  Dim formatID As MemoryBlock
  'https://msdn.microsoft.com/en-us/library/windows/desktop/jj553591(v=vs.85).aspx
  formatID = COM.IIDFromString("{32CE38B2-2C9A-41B1-9BC5-B3784394AA44}")
  Dim pformatID As Ptr = formatID
  
  'https://msdn.microsoft.com/en-us/library/windows/desktop/bb773381(v=vs.85).aspx
  Dim pk As PROPERTYKEY
  pk.fmtid = pformatID.GUID
  pk.pid = 2
  
  'https://msdn.microsoft.com/en-us/library/windows/desktop/aa380072(v=vs.85).aspx
  Dim propvariant As PROPVARIANT_BOOL
  propvariant.vt = VT_BOOL
  propvariant.boolVal = Com.RBBooleanToVARIANTBOOL(State)
  
  #If Target64Bit
    Const sizeOfPtr = 8
  #Else
    Const sizeOfPtr = 4
  #EndIf
  
  'IPropertyStoreVtbl - propsys.h
  
  Dim setValueFunc As New SetValue(PropertyStore.Ptr(0).Ptr(6 * sizeOfPtr))
  result = setValueFunc.Invoke(PropertyStore, pk, propvariant)
  
  Dim releaseFunc As New Release(PropertyStore.Ptr(0).Ptr(2 * sizeOfPtr))
  Call releaseFunc.Invoke(PropertyStore)
  
End If

If (CoInit And RPC_E_CHANGED_MODE) <> RPC_E_CHANGED_MODE Then
  'https://msdn.microsoft.com/en-us/library/windows/desktop/ms695279(v=vs.85).aspx
  Declare Sub CoUninitialize Lib "Ole32" ()
  CoUninitialize
End If

End If

Return result
End Function
[/code]

Christian also added support for this to his api’s

[code]dim w as new WindowsPropertiesMBS(self)
dim key as string = w.EdgeGestureDisableTouchWhenFullscreen

w.Value(key) = true[/code]