Hi
mal ne frage hab 2 Gui's und eine davon soll eine feste Position haben also darf auch nicht von user beweglich sein. wie mache ich das
MfG EmEx
Hi
mal ne frage hab 2 Gui's und eine davon soll eine feste Position haben also darf auch nicht von user beweglich sein. wie mache ich das
MfG EmEx
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global Const $WM_MOVING = 0x3
[/autoit] [autoit][/autoit] [autoit]$main = GUICreate("App", 200, 150, (@DesktopWidth / 2) - 100, (@DesktopHeight / 2) - 100)
[/autoit] [autoit][/autoit] [autoit]$btn = GUICtrlCreateButton("Close", 20, 100, 150)
[/autoit] [autoit][/autoit] [autoit]GUIRegisterMsg($WM_MOVING, "_MY_WM_MOVE")
[/autoit] [autoit][/autoit] [autoit]GUISetState()
[/autoit] [autoit][/autoit] [autoit]While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Or $msg = $btn Then Exit
WEnd
Func _MY_WM_MOVE($hWndGUI, $MsgID, $WParam, $LParam)
If $hWndGUI = $main Then
Local $aWinPos = WinGetPos($hWndGUI, '')
Local $iXPos = (@DesktopWidth / 2) - 100, $iYPos = (@DesktopHeight / 2) - 100
If IsArray($aWinPos) And ($aWinPos[0] <> $iXPos Or $aWinPos[1] <> $iXPos) Then
WinMove($hWndGUI, '', $iXPos, $iYPos)
EndIf
EndIf
EndFunc ;==>_MY_WM_MOVE
so ungefähr?
[autoit]
; Nach dem erstellen und ausrichten deines Fensters das hier:
$WinPosOld = WinGetPos("DeinZweitesFenster")
; Dann in der While schleife
While 1
local $WinPosNew = WinGetPos("DeinZweitesFenster")
If $WinPosNew[0] <> $WinPosOld[0] OR $WinPosNew[1] <> $WinPosOld[1] OR $WinPosNew[2] <> $WinPosOld[2] OR $WinPosNew[3] <> $WinPosOld[3] Then
WinMove("DeinZweitesFenster","",$WinPosOld[0],$WinPosOld[1],$WinPosOld[2],$WinPosOld[3])
EndIf
sleep(20)
WEnd
Frei ausm kopf geschrieben - keine Garantie!
EDIT: GRRR warum sind alle schneller als ich?
Und dann auch noch mit Antworten die mir selbst besser gefallen >.>
habs hinbekommen danke