;filename: Example for _WindowControlOperationsUDF usage.au3 #AutoIt3Wrapper_run_debug_mode=Y ;use this to debug in console window <--- LOOK #include "_WindowControlOperationsUDF.au3" ;included so can adjust window and controls ;code below an example window with controls #include #include #include #include AutoItSetOption("MustDeclareVars", 1) Global $debug = 0 ;0=off, 1=on, 2+ deeper Global $pos1 = MouseGetPos() Global $pos2 = MouseGetPos() ; must be initialized Global $dll = DllOpen("user32.dll") Opt("MouseCoordMode", 0) ;1=absolute, 0=relative, 2=client ;this is for the main program Global $hControl, $ControlID ;assigned in Func _GetControlHandle() ;at mouse x,y location ;create an example window with a couple of controls to work with Global $hGUI = GUICreate("Test", 500, 400) ;the main window Global $iLeft = 10, $iTop = 10, $iWidth = 200, $iHeight = 250 Global $cIDEdit1 = GUICtrlCreateEdit("Edit control #1", $iLeft, $iTop, $iWidth, $iHeight, Bitor($ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL, $WS_HSCROLL)) Global $cIDEdit2 = GUICtrlCreateEdit("Edit control #2", 200, 200, 250, 100, Bitor($ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL, $WS_HSCROLL)) Local $idButton_Nice = GUICtrlCreateButton("Nice", 294, 177, 85, 25) ;create button control Local $idCheckbox1 = GUICtrlCreateCheckbox("Checkbox1", 301, 146, 185, 25) Local $idCheckbox2 = GUICtrlCreateCheckbox("Checkbox2", 301, 246, 185, 25) Global $sWindowOperationsState = "off" GUISetState(@SW_SHOW, $hGUI) ;show it MsgBox(262144, "USAGE", "Example window with edit and button controls showing." &@CRLF&@CRLF& "Press Alt+W (once or twice) after clicking OK to enter window/control mode.") Local $nMsg While 1 ;this is your code main loop $nMsg = GUIGetMsg() If $nMsg <> 0 Then ;we have a message so Switch $nMsg ;Check for GUI events Case $GUI_EVENT_CLOSE ;the GUI is closed red [X] is clicked Exit Case Else ;do nothing EndSwitch ;End running through GUI events. Else ;no message Sleep(100) ;do something in your program EndIf ;---------------------------------------------------------------------------------------------------------------------------+ ;UDF so user needs to: | ; #include "_WindowControlOperationsUDF.au3" if _WindowControlOperationsUDF.au3 in the script directory OR | ; #include "[path\]_WindowControlOperationsUDF.au3" if _WindowControlOperationsUDF.au3 located somewhere else | ; see help file for #include for other places to locate _WindowControlOperationsUDF.au3 | ;ADD this function into your $nMsg loop after the $nMsg EndIf ;as shown here or in your While 1 loop so it gets executed | _WindowControlOperations() ;let's go into move/adjust window/control operations if Alt+W pressed | ;comment out this function call when all done, or delete it | ;---------------------------------------------------------------------------------------------------------------------------+ WEnd