Jump to content

How to react to Win 11 split screen dialog


Recommended Posts

I monitor an external window for resizing with the WinGetPos() function. This allows me to detect every move, minimize, maximize, restore and resize. One problem, however, is the SplitScreen dialog in Windows 11.

win11_split.png.46b02f2a12d3d0369388498b3cc015d2.png

If the size or position of the window is changed via this dialog, no associated event is usually triggered or it is not recognizable. This is clearly visible in the example script if the position of the window is frequently changed via the split dialog.

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>


Global $hGui = GUICreate('Test', 300, 200, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_CAPTION,$WS_POPUP,$WS_MAXIMIZEBOX,$WS_SIZEBOX))
GUISetState()
_ConsoleWriteSize('START')

While True
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $GUI_EVENT_MINIMIZE
            _ConsoleWriteSize('GUI_EVENT_MINIMIZE')
        Case $GUI_EVENT_RESTORE
            _ConsoleWriteSize('GUI_EVENT_RESTORE')
        Case $GUI_EVENT_MAXIMIZE
            _ConsoleWriteSize('GUI_EVENT_MAXIMIZE')
        Case $GUI_EVENT_RESIZED
            _ConsoleWriteSize('GUI_EVENT_RESIZED')
        Case $GUI_EVENT_PRIMARYUP
            _ConsoleWriteSize('SPLIT SCREEN DIALOG')
    EndSwitch
WEnd

Func _ConsoleWriteSize($_sMsg)
    Local Static $n = 0
    $n += 1
    Local $aWnd = WinGetPos($hGui)
    ConsoleWrite(StringFormat('[%s] %d, %d, %d, %d\t%s', $n, $aWnd[0], $aWnd[1], $aWnd[2], $aWnd[3], $_sMsg) & @CRLF)
EndFunc

What options do I have to react to the split dialog?
I have tried to intercept the events with SHELLHOOK, but this only seems to work with self-created windows.

EDIT: SHELLHOOK works, but does not recognize the window handle.
I get the following information when the split screen dialog was used:

$HSHELL_RUDEAPPACTIVATED: 
    PID: -1
    ClassName: 
    hWnd: 0x00000000

 

Edited by BugFix

Best Regards BugFix  

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...