boltc Posted October 22, 2007 Posted October 22, 2007 hello,, i want to load a window/executable in my gui.. this works fine, but it is possible to move the window inside my gui.. i want to lock the movement of the window/executable in my gui.. can someone help me with it? because i cant get it working.. thanks in advance! expandcollapse popup#include <GUIConstants.au3> $hGUI = GUICreate("Test", 800, 600, -1, -1, BitOr($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN)) $PID = Run(@WindowsDir & "\regedit.exe", "", @SW_HIDE) $hWnd = 0 $stPID = DllStructCreate("int") Do $WinList = WinList() For $i = 1 To $WinList[0][0] If $WinList[$i][0] <> "" Then DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $WinList[$i][1], "ptr", DllStructGetPtr($stPID)) If DllStructGetData($stPID, 1) = $PID Then $hWnd = $WinList[$i][1] ExitLoop EndIf EndIf Next Sleep(100) Until $hWnd <> 0 $stPID = 0 If $hWnd <> 0 Then $nExStyle = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hWnd, "int", -20) $nExStyle = $nExStyle[0] DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", -20, "int", BitOr($nExStyle, $WS_EX_MDICHILD)) DllCall("user32.dll", "int", "SetParent", "hwnd", $hWnd, "hwnd", $hGUI) WinSetState($hWnd, "", @SW_SHOW) WinMove($hWnd, "", 0, 0, 600, 400) EndIf GUISetState() While 1 $msg = GUIGetMsg() If $msg = -3 Then ExitLoop WEnd
Blue_Drache Posted October 22, 2007 Posted October 22, 2007 $winPos = WinGetPos($hwnd) If $winPos[0] <> 600 and $winPos[1] <> 400 then WinMove($hwnd,"",0,0,600,400) endif Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
boltc Posted October 22, 2007 Author Posted October 22, 2007 $winPos = WinGetPos($hwnd) If $winPos[0] <> 600 and $winPos[1] <> 400 then WinMove($hwnd,"",0,0,600,400) endif this works, but it is kinda buggy maybe something with movewindow in user32.dll?
boltc Posted October 22, 2007 Author Posted October 22, 2007 or is it possible to remove the titlebar and borders from an external program?
boltc Posted October 22, 2007 Author Posted October 22, 2007 fixed now.. expandcollapse popup#include <GUIConstants.au3> ; ==== LOAD GAMEMAKER ==..;; $hGUI = GUICreate("Test", 1000, 600, -1, -1, BitOr($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN)) $PID = Run("C:\Game_Maker7\game_maker.exe", "", @SW_HIDE) $hWnd = 0 $stPID = DllStructCreate("int") ;Set Window Styles Func WinSetStyle($hWnd, $Style = -1, $ExStyle = 0) Local Const $GWL_STYLE = -16 Local Const $GWL_EXSTYLE = -20 Local Const $SWP_NOMOVE = 0x2 Local Const $SWP_NOSIZE = 0x1 Local Const $SWP_SHOWWINDOW = 0x40 Local Const $SWP_NOZORDER = 0x4 Local $iFlags = BitOR($SWP_SHOWWINDOW, $SWP_NOSIZE, $SWP_NOMOVE, $SWP_NOZORDER) If $Style = -1 Then $Style = $WS_MINIMIZEBOX + $WS_CAPTION + $WS_POPUP + $WS_SYSMENU DllCall("User32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE, "int", $Style) DllCall("User32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_EXSTYLE, "int", $ExStyle) DllCall("User32.dll", "int", "SetWindowPos", "hwnd", $hWnd, "hwnd", 0, "int", 0, "int", 0, _ "int", 0, "int", 0, "int", $iFlags) EndFunc Do $WinList = WinList() For $i = 1 To $WinList[0][0] If $WinList[$i][0] <> "" Then DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $WinList[$i][1], "ptr", DllStructGetPtr($stPID)) If DllStructGetData($stPID, 1) = $PID Then $hWnd = $WinList[$i][1] ExitLoop EndIf EndIf Next Sleep(100) Until $hWnd <> 0 $stPID = 0 If $hWnd <> 0 Then $nExStyle = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hWnd, "int", -20) $nExStyle = $nExStyle[0] DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", -20, "int", BitOr($nExStyle, $WS_EX_MDICHILD)) DllCall("user32.dll", "int", "SetParent", "hwnd", $hWnd, "hwnd", $hGUI) WinSetState($hWnd, "", @SW_SHOW) WinMove($hWnd, "", 0, 0, 800, 600) WinSetStyle($hWnd, $WS_POPUPWINDOW, $WS_EX_CLIENTEDGE + $WS_EX_TOOLWINDOW) EndIf GUISetState() While 1 $msg = GUIGetMsg() If $msg = -3 Then ExitLoop WEnd
Moderators SmOke_N Posted October 22, 2007 Moderators Posted October 22, 2007 You can replace:DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $WinList[$i][1], "ptr", DllStructGetPtr($stPID)) If DllStructGetData($stPID, 1) = $PID ThenoÝ÷ Ùh«¢+Ù%]¥¹ÑAɽÍÌ ÀÌØí]¥¹1¥ÍÑlÀÌØí¥ulÅt¤ôÀÌØíA%Q¡ Nice job btw. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now