Hi com,
ich habe lange nichts mehr gefragt, es war auch nie wirklich nötig.
Aber jetzt bin ich ratlos. Dieses Beispiel is nur simpel gehalten, aber es will einfach nicht funktionieren, warum?
Spoiler anzeigen
#include <WindowsConstants.au3>
#include <Misc.au3>
HotKeySet("{F3}", "_Exit")
Global $hWnd = GUICreate("Untitled", 100, 100, Default, Default, -$WS_POPUP)
GUICtrlSetColor(-1, 0xFFFFFF)
GUISetState(@SW_SHOW)
While 1
_WinAPI_CheckWinMove($hWnd)
WEnd
Func _Exit()
Exit
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _WinAPI_CheckWinMove
; Description ...: Checks if a Gui need to move While dragging
; Syntax.........: _WinAPI_CheckWinMove($hWnd[, $sMCode])
; Parameters ....: $hWnd - Handle to the Gui
; [optional] $sMCode - Code of Button (Please use Mouse Codes) for func _Ispressed()
; Return values .: none
; Author ........: black_skorpi
; Modified.......:
; Remarks .......: Pauses the Script
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _WinAPI_CheckWinMove($hWnd, $sMCode = "01")
Global $aMPos, $aWPos, $aMPosOld = MouseGetPos()
While _IsPressed("01")
$aMPos = MouseGetPos()
$aWPos = WinGetPos(WinGetTitle($hWnd, ""))
If Not ($aMPos[0] = $aMPosOld) And ($aMPos[1] = $aMPosOld[1]) Then
WinMove(WinGetTitle($hWnd, ""), "", $aWPos[0] - ($aMPosOld[0] - $aMPos[0]), $aWPos[1] - ($aMPosOld[1] - $aMPos[1]), $aWPos[2], $aWPos[3])
EndIf
$aMPosOld = $aMPos
WEnd
EndFunc
Das Fenster sollte sich mit der Maus bewegen, wenn man die linke Maustaste gedrückt hält.
Dass das auch außerhalb eines Gui funktioniert, beachte ich noch nicht.