Sign in to follow this  
Followers 0
senatin

Is there MouseMode that only interact topmostlayer

1 post in this topic

I tried some codes to set a windowposition to Zoder or to nontopmost to allow me to take control of my cursor.
The problem is when I interact in some features of my application my cursor then dont respond to my mouse movement until It finish loading what content have to show, but I notice that when I click alt+tab or winkeys, its possible to point my cursor to another features of the same application and click.

So I desided to make a script that will send alt+tab or winkey so I can click more features alltogether, but It doesnt work either, the application block aswell those option I dont know why.
so I desided to script that the application will always be at the background so my cursor is always in TopLayer but it still didnt work. I tried to disable enable the windows state and still with no luck.
I even Combined all gathered script. Here my script

#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <WinAPIProc.au3>
#include <WinAPISys.au3>

HotKeySet( "{INS}", "start")
HotKeySet( "{ESC}", "end")

Local $haWnd = WinGetHandle("Appnamehere", "")

Local $iStyle = _WinAPI_GetWindowLong($haWnd, $GWL_STYLE)
 $iStyle = BitXOR($iStyle, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX)
 _WinAPI_SetWindowLong($haWnd, $GWL_STYLE, $iStyle)
 Local $hParent = WinGetHandle('[CLASS:Progman;TITLE:Program Manager]')
_WinAPI_SetParent($haWnd, $hParent)

While 1
    Sleep(100)
WEnd


Func start()
     MouseMove (400, 120)
     MouseDown("left")

     WinSetState( $haWnd, "", @SW_DISABLE)
    _WinSetZOrderPos($haWnd, Default)
     WinSetState( $haWnd, "", @SW_ENABLE)
     MouseUp("left")
    Sleep(1000)
     MouseMove (520, 120)
      MouseDown("left")

    _WinSetZOrderPos($haWnd, Default)

     MouseUp("left")
     Sleep(1000)
     MouseMove (520, 220)
    MouseDown("left")

    _WinSetZOrderPos($haWnd, Default)

     MouseUp("left")
     Sleep(1000)
EndFunc

Func end()
    Exit
EndFunc


 Func _WinSetZOrderPos($hWnd, $hWndAfter = 0, $bRemoveMaximize = 0, _
        $bRemoveMinimize = 0, $bRemoveSizeBox = 0)

    $hWndAfter = ((IsKeyword($hWnd) Or $hWndAfter < 1) ? 0 : $hWndAfter)

    Local $ahWnds
    If Not $hWndAfter Then
        $ahWnds = _WinAPI_EnumDesktopWindows(_WinAPI_GetThreadDesktop( _
            _WinAPI_GetCurrentThreadId()))
        If @error Or Not IsArray($ahWnds) Then
            Return SetError(1, 0, 0)
        EndIf
        If $ahWnds[0][0] > 1 Then
            $hWndAfter = $ahWnds[$ahWnds[0][0]][0]
        EndIf
    EndIf

    Local $iStyle
    If $bRemoveMaximize Or $bRemoveMinimize Or $bRemoveSizeBox Then
        $iStyle = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE)
        If $bRemoveMaximize Then $iStyle = BitXOR($iStyle, $WS_MAXIMIZEBOX)
        If $bRemoveMinimize Then $iStyle = BitXOR($iStyle, $WS_MINIMIZEBOX)
        If $bRemoveSizeBox Then $iStyle = BitXOR($iStyle, $WS_SIZEBOX)
        _WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $iStyle)
    EndIf

    Local $bRet = _WinAPI_SetWindowPos($hWnd, $hWndAfter, 0, 0, 0, 0, _
        BitOR($SWP_FRAMECHANGED, $SWP_NOSIZE, $SWP_NOMOVE, $SWP_NOACTIVATE))
    If @error Or Not $bRet Then
        Return SetError(2, 0, 0)
    EndIf

    Return $bRet
EndFunc


I Hope you can help me Please

Share this post


Link to post
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
Sign in to follow this  
Followers 0