Jump to content

Search the Community

Showing results for tags 'halp'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Is there a way to register my script to receive messages for when a window is moving or has been moved? I've used _WinAPI_SetWindowsHookEx and all of the various options in many different combos. Been at this for a couple of days now. I've searched this forum and the net too. Seems like I can only do this for specific programs that I specify? If that is the case, then I guess I can register and unregister dynamically. Any ideas? Edit: guess I should state my intent. I want to make a Snap feature that works in the middle of where monitors meet if there are more than one. I know I can use the KB shortcuts and will if that's my only choice. Here my code so far: #AutoIt3Wrapper_Run_AU3Check=n #AutoIt3Wrapper_AU3Check_Parameters=-w 1 -w 2 -w 3 -w 4 -w 6 -w 7 -d -q #include <WinAPI.au3> #include <Array.au3> #include <WindowsConstants.au3> Const $mouse_proc_callback = DllCallbackRegister(model_ll_mouse_proc, "long", "int;wparam;lparam") Const $hook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($mouse_proc_callback), _WinAPI_GetModuleHandle(0)) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hook = ' & $hook & @CRLF) ;### Debug Console Const $half_desktop_width = @DesktopWidth / 2 Const $range = 20 Global $window_focus Global $left_snap = False Global $right_snap = False Global $active = False Do Sleep(100) Until False Volatile Func model_ll_mouse_proc($code, $w_param, $l_param) Switch $code >= 0 Case True Switch $w_param Case $wm_mousemove Switch $active Case True With DllStructCreate($tagPOINT, $l_param) Select Case (.X >= @DesktopWidth - $range) And (.X <= @DesktopWidth) ;ConsoleWrite("Left: " & .X & @CRLF) $left_snap = True $right_snap = False Case (.X >= @DesktopWidth) And (.X <= @DesktopWidth + $range) ;ConsoleWrite("Right: " & .X & @CRLF) $right_snap = True $left_snap = False Case Else $left_snap = False $right_snap = False EndSelect EndWith EndSwitch Case $wm_lbuttondown $window_focus = _WinAPI_GetForegroundWindow() If GetRealParent($window_focus) Then EndIf $active = True Case $wm_lbuttonup Select Case $left_snap WinMove($window_focus, "", $half_desktop_width, 0, $half_desktop_width, 1080) $left_snap = False $right_snap = False Case $right_snap WinMove($window_focus, "", @DesktopWidth, $half_desktop_width, $half_desktop_width, 1024) $left_snap = False $right_snap = False EndSelect $active = False $window_focus = Null EndSwitch EndSwitch Return _WinAPI_CallNextHookEx($hook, $code, $w_param, $l_param) EndFunc Func GetRealParent(Const $hwnd) ; http://stackoverflow.com/questions/16872126/the-correct-way-of-getting-the-parent-window Local Const $hParent = _WinAPI_GetAncestor($hwnd, $GA_PARENT) If (Not $hParent) Or ($hParent = _WinAPI_GetDesktopWindow()) Then Return True EndIf Return False EndFunc Here is the script I used to test setwindowshookex function: #include <WinAPI.au3> Const $wnd_proc_callback = DllCallbackRegister(_call_wnd_proc, "long", "int;wparam;lparam") Const $hook = _WinAPI_SetWindowsHookEx($WH_CALLWNDPROC, DllCallbackGetPtr($wnd_proc_callback), _WinAPI_GetModuleHandle(0)) Do Sleep(100) Until False Func _call_wnd_proc($code, $w_param, $l_param) ConsoleWrite("Heeeeeyyyyy" & @CRLF) Return _WinAPI_CallNextHookEx($hook, $code, $w_param, $l_param) EndFunc
×
×
  • Create New...