Mordanthanus Posted October 11, 2009 Share Posted October 11, 2009 What I'm wanting to do is gonna sound pretty strange. I play a game called Wonderland Online. Usually while playing, I will have between 3-4 instances of the game going at the same time, each instance running a different character. Also, I will have open another program that I wrote in AutoIt that helps me figure out what I need to manufacture a certain item. The running game is an 800x600 window, and I have all 5 of these windows open at once, where I am constantly moving things around, minimizing and maximizing. Now to my idea... I want to create a GUI that would basically be a frame for the game. Creating a GUI is not hard, but this is the first time I have tried to get an external EXE to basically run inside of my program. Is this even possible? And if so, I would imagine I could run multiple EXEs and flip between them inside my GUI. I could integrate my manufacturing program into the frame, as well as control which instance of the game is visible inside the frame. Thanks in advance for any help with this question. (And for any of you who love anime 2D games, this one is fun... hehehe) ˙˙˙ʎɐqǝ uo pɹɐoqʎǝʞ ɐ ʎnq ı ǝɯıʇ ʇsɐן Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 11, 2009 Share Posted October 11, 2009 Windowing just doesn't work that way. You'd be better off hiding windows and switching which one you show. Link to comment Share on other sites More sharing options...
Mordanthanus Posted October 11, 2009 Author Share Posted October 11, 2009 What about making the blue area in my example into a GUI element that could be set to transparent, and have the game app show through it? Or have my script keep the game app on top and always in the same location on top of my frame... ˙˙˙ʎɐqǝ uo pɹɐoqʎǝʞ ɐ ʎnq ı ǝɯıʇ ʇsɐן Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 11, 2009 Share Posted October 11, 2009 That would work but would look awful silly. Link to comment Share on other sites More sharing options...
Mordanthanus Posted October 11, 2009 Author Share Posted October 11, 2009 Hence my wanting to run it INSIDE my app... lol Like a child window or something. ˙˙˙ʎɐqǝ uo pɹɐoqʎǝʞ ɐ ʎnq ı ǝɯıʇ ʇsɐן Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 11, 2009 Share Posted October 11, 2009 Having a parent window that belongs to another process is just not the way it works. Link to comment Share on other sites More sharing options...
Mordanthanus Posted October 11, 2009 Author Share Posted October 11, 2009 I wonder if this would work as a better idea... Basically, it would be three separate programs running on the screen... The game app running in the top left corner, the "controller program" running along the left side of the screen and the manufacturing app at the bottom, same as my layout except that the controller program keeps everything laid out where it should be on the screen. By clicking a button in the controller, it woul automatically minimize the current game window and bring up the one selected. ˙˙˙ʎɐqǝ uo pɹɐoqʎǝʞ ɐ ʎnq ı ǝɯıʇ ʇsɐן Link to comment Share on other sites More sharing options...
Mordanthanus Posted October 11, 2009 Author Share Posted October 11, 2009 The only problem I see with this idea it that all of the instances of the game app would have the same title bar text... no way to differentiate between instances... ˙˙˙ʎɐqǝ uo pɹɐoqʎǝʞ ɐ ʎnq ı ǝɯıʇ ʇsɐן Link to comment Share on other sites More sharing options...
Valuater Posted October 11, 2009 Share Posted October 11, 2009 That is exactly what "Welcome to Autoit 1-2-3 does. It runs others programs inside its main window.here is an example from XSkin...expandcollapse popup#include <GUIConstants.au3> #include <XSkin.au3> #include <XSkinShell.au3> #include <XSkinGradient.au3> Dim $loop, $Myrunner ; folder of skin $Skin_Folder = @ScriptDir & "\Skins\Universal" $XSkinGui = XSkinGUICreate ( "My GUI", 400, 450, $Skin_Folder) $Icon_Folder = @ScriptDir & "\Skins\Default" $XIcon = XSkinIcon ($XSkinGui, 1) $Button_1 = XSkinButton ("ReSize a Program", 130, 130, 120, 30, "CallResize") ; mouse-over color automatic GUICtrlSetTip($Button_1, "Some programs will need to be re-sized") $Button_2 = XSkinButton ("Run - Notepad", 130, 165, 120, 30, "CallRun") ; mouse-over color automatic $Button_3 = XSkinButton ("Explore - Internet", 130, 200, 120, 30, "CallInternet") ; mouse-over color automatic $Button_4 = XSkinButton ("Explore - Hard Drive", 130, 235, 120, 30, "CallHardDrive") ; mouse-over color automatic $Button_5 = XSkinIconButton ("Exit", 130, 270, 120, 30, 240) ; Icon button - No mouse-over color ;_XSkinGradient($XSkinGui, $bkg_color, $btn_color) GUISetState() While 1 MouseOver () $msg = GUIGetMsg() If $msg = $XIcon[1]Or $msg = $Button_5 Then Exit If $loop Then CheckWindow() WEnd Func CallResize() ;; XSkinReSize( $XRS_Program, $XSR_Width, $XSR_Height) ;; some programs may need to be resized XSkinReSize ( "notepad.exe", 500, 400) EndFunc ;==>CallResize Func CallRun() ;; XSkinRun( $XR_Title, $XR_Program) $Myrunner = XSkinRun ("My Notepad", "notepad.exe") $loop = 1 EndFunc ;==>CallRun Func CallInternet() ;; XSkinExplore( $XSI_Title, $XSI_Location, $XSI_Width, $XSI_Height) $Myrunner = XSkinExplore ( "My Internet", "http://www.autoitscript.com/forum/index.php?showtopic=32494", 720, 600) $loop = 1 EndFunc ;==>CallInternet Func CallHardDrive() ;; XSkinExplore( $XSI_Title, $XSI_Location, $XSI_Width, $XSI_Height) $Myrunner = XSkinExplore ( "My Programs", @ScriptDir, 600, 500) $loop = 1 EndFunc ;==>CallHardDrive Func CheckWindow() While WinExists($Myrunner[0]) And WinExists($Myrunner[1]) $XRM_msg = GUIGetMsg() If $XRM_msg = $Myrunner[2]Then ExitLoop ; exit button on parent WEnd WinClose($Myrunner[1]) ; the executed program GUIDelete($Myrunner[0]) ; the "parent" XSkin $loop = 0 EndFunc ;==>CheckWindow**** NOTE THE REQUIRED INCLUDES *** Link to comment Share on other sites More sharing options...
Mordanthanus Posted October 11, 2009 Author Share Posted October 11, 2009 That looks like a great addon for AutoIt Val... I have clicked through the links in your sig checking it out, but I cannot find a place to download all of the required includes. ˙˙˙ʎɐqǝ uo pɹɐoqʎǝʞ ɐ ʎnq ı ǝɯıʇ ʇsɐן Link to comment Share on other sites More sharing options...
Valuater Posted October 11, 2009 Share Posted October 11, 2009 I have just noticed that many things are missing since the move to this forum! XSkin.au3 is there in Example scripts. XSkinGradient is NOT required. Here is XSkinShell.au3 expandcollapse popup; Ver 1.1.0 Autoit Ver v3.2.12.0 5/22/2008 - Requires XSkin.au3 #include <GUIConstantsEx.au3> #include-once #include <XSkin.au3> ;Opt("MustDeclareVars", 1) Func XSkinReSize($XRS_Program, $XSR_Width, $XSR_Height) Local $XSPID, $XhWnd = 0, $XstPID = DllStructCreate("int"), $XSWinList, $XSdll, $XPID $XSPID = Run($XRS_Program, '', @SW_HIDE) Do $XSWinList = WinList() For $i = 1 To $XSWinList[0][0] If $XSWinList[$i][0] <> "" Then DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $XSWinList[$i][1], "ptr", DllStructGetPtr($XstPID)) If DllStructGetData($XstPID, 1) = $XSPID Then $XhWnd = $XSWinList[$i][1] ExitLoop EndIf EndIf Next Sleep(20) Until $XhWnd <> 0 $XSdll = "" $XstPID = 0 If $XhWnd <> 0 Then WinMove($XhWnd, "", 200, 200, $XSR_Width, $XSR_Height) Sleep(100) WinClose($XhWnd) EndIf EndFunc ;==>XSkinReSize Func XSkinRun($XR_Title, $XR_Program = "") ; thanks holger If $XR_Program = "" Then Return Local $XhWnd = 0, $XstPID = DllStructCreate("int"), $XSWinList, $XhWinSize, $XSdll, $XPID, $XPID2, $XR_Ret[3], $Xh_ret, $oxStyle, $ostyle $XPID = Run($XR_Program, '', @SW_HIDE) Do $XSWinList = WinList() For $i = 1 To $XSWinList[0][0] If $XSWinList[$i][0] <> "" Then DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $XSWinList[$i][1], "ptr", DllStructGetPtr($XstPID)) If DllStructGetData($XstPID, 1) = $XPID Then $XhWnd = $XSWinList[$i][1] ExitLoop EndIf EndIf Next Sleep(20) Until $XhWnd <> 0 $XSdll = "" $XstPID = 0 If $XhWnd <> 0 Then $XhWinSize = WinGetPos($XhWnd) $XPID2 = XSkinGUICreate ( $XR_Title, ($XhWinSize[2]) + ($tile_size * 2) , ($XhWinSize[3]) + ($tile_size * 2), $Skin_Folder) If FileExists($Icon_Folder) Then $Xh_ret = XSkinIcon ($XPID2) $oxStyle = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $XPID2, "int", -16) DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $XPID2, "int", -16, "long", BitOR($oxStyle[0], $WS_CLIPCHILDREN)) $ostyle = DllCall("user32.dll", "long", "GetWindowLong", "hwnd", $XhWnd, "int", -16) DllCall("user32.dll", "int", "SetParent", "hwnd", $XhWnd, "hwnd", $XPID2) DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $XhWnd, "int", -16, "long", BitOR($WS_POPUP, $WS_CHILD, $WS_VISIBLE, $WS_CLIPSIBLINGS)) GUISetState() WinMove($XhWnd, "", $tile_size, $tile_size) WinSetState($XhWnd, "", @SW_SHOW) WinActivate($XhWnd) $XR_Ret[0] = $XPID2 $XR_Ret[1] = $XhWnd $XR_Ret[2] = $Xh_ret[1] Return $XR_Ret EndIf EndFunc ;==>XSkinRun Func XSkinExplore($XSI_Title, $XSI_Location, $XSI_Width, $XSI_Height) Local $oXIE, $XSI_Ret[3], $XSI_but, $XSI_gui, $oXActiveX $oXIE = ObjCreate("Shell.Explorer.2") $XSI_gui = XSkinGUICreate ($XSI_Title, $XSI_Width + ($tile_size * 2), $XSI_Height + ($tile_size * 2), $Skin_Folder) If FileExists($Icon_Folder) Then $XSI_but = XSkinIcon ($XSI_gui) $oXActiveX = GUICtrlCreateObj($oXIE, $tile_size, $tile_size, $XSI_Width, $XSI_Height) $oXIE.navigate ($XSI_Location) GUISetState() $XSI_Ret[1] = $XSI_Ret[0] $XSI_Ret[2] = $XSI_but[1] Return $XSI_Ret EndFunc ;==>XSkinExplore 8) Link to comment Share on other sites More sharing options...
Mordanthanus Posted October 11, 2009 Author Share Posted October 11, 2009 The XSkinShell was what I was looking for... I went out and got the skins and such. I run the script and it works - but when I click anything in it, it opens something else for a sec, then closes. Here is the error. >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\Mordanthanus\Documents\AutoIt Scripts\Test1.au3" /autoit3dir "C:\Program Files (x86)\AutoIt3" /UserParams +>14:43:45 Starting AutoIt3Wrapper v.2.0.0.1 Environment(Language:0409 Keyboard:00000409 OS:WIN_VISTA/ CPU:X64 OS:X64) >Running AU3Check (1.54.14.0) from:C:\Program Files (x86)\AutoIt3 +>14:43:45 AU3Check ended.rc:0 >Running:(3.3.0.0):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Users\Mordanthanus\Documents\AutoIt Scripts\Test1.au3" C:\Users\Mordanthanus\Documents\AutoIt Scripts\XSkinShell.au3 (68) : ==> Subscript used with non-Array variable.: $XR_Ret[2] = $Xh_ret[1] $XR_Ret[2] = $Xh_ret^ ERROR ->14:43:47 AutoIT3.exe ended.rc:1 +>14:43:48 AutoIt3Wrapper Finished >Exit code: 1 Time: 3.306 ˙˙˙ʎɐqǝ uo pɹɐoqʎǝʞ ɐ ʎnq ı ǝɯıʇ ʇsɐן Link to comment Share on other sites More sharing options...
Mordanthanus Posted October 11, 2009 Author Share Posted October 11, 2009 I found the line in XSkinShell and commented it out, but then it doesn't work at all... lol ˙˙˙ʎɐqǝ uo pɹɐoqʎǝʞ ɐ ʎnq ı ǝɯıʇ ʇsɐן Link to comment Share on other sites More sharing options...
Mordanthanus Posted October 11, 2009 Author Share Posted October 11, 2009 (edited) I found the DIMed variables in XSkin.au3... but that var isn't one of them. I must be using an older version of this file. Could you also post this one as well? The one I have has this at the top... ; XSkin.au3 v1.4.1 Jan. 22, 2009 ; ,,,, Valuater and here is the declared vars... ;Opt("MustDeclareVars", 1) Dim $CtrlIDA[1], $CtrlIDB[1], $CtrlIDC[1], $CtrlIDMA[3], $CtrlIDMB[3], $XS_gui[1], $Skin_Folder, $Icon_Folder, $iLoop, $XS_debug = 0 Dim $over_color, $btn_color, $bkg_color, $fnt_color, $tile_size, $XS_TMB, $XS_TMA, $SKBox_[2], $XSkinID[1] Dim $XSolid = 1, $XSlid = 1, $XSlid1, $XSlid2, $XSlid3, $XSlpr, $XS_Isize, $XS_Istyle, $XadjLt, $XadjDn, $XStrans = 200 Dim $GlobalHeader, $GlobalCorners, $Globalcolor, $CtrlButton[1][4] I tried to add it, but gives the same error. Edited October 11, 2009 by Mordanthanus ˙˙˙ʎɐqǝ uo pɹɐoqʎǝʞ ɐ ʎnq ı ǝɯıʇ ʇsɐן Link to comment Share on other sites More sharing options...
Valuater Posted October 11, 2009 Share Posted October 11, 2009 I am on Win XP sp3. I noticed you have "C:\Program Files (x86)". Maybe a problem there with your OS This worked for me.... expandcollapse popup#include <GUIConstantsEx.au3> #include <XSkin.au3> ;#include <XSkinShell.au3> Dim $loop, $Myrunner ; folder of skin $Skin_Folder = @ScriptDir & "\Skins\Universal" $XSkinGui = XSkinGUICreate ( "My GUI", 400, 450, $Skin_Folder) $Icon_Folder = @ScriptDir & "\Skins\Default" $XIcon = XSkinIcon ($XSkinGui, 1) $Button_1 = XSkinButton ("ReSize a Program", 130, 130, 120, 30, "CallResize") ; mouse-over color automatic GUICtrlSetTip($Button_1, "Some programs will need to be re-sized") $Button_2 = XSkinButton ("Run - Notepad", 130, 165, 120, 30, "CallRun") ; mouse-over color automatic $Button_3 = XSkinButton ("Explore - Internet", 130, 200, 120, 30, "CallInternet") ; mouse-over color automatic $Button_4 = XSkinButton ("Explore - Hard Drive", 130, 235, 120, 30, "CallHardDrive") ; mouse-over color automatic $Button_5 = XSkinIconButton ("Exit", 130, 270, 120, 30, 240) ; Icon button - No mouse-over color GUISetState() While 1 MouseOver () $msg = GUIGetMsg() If $msg = $XIcon[1]Or $msg = $Button_5 Then Exit If $loop Then CheckWindow() WEnd Func CallResize() ;; XSkinReSize( $XRS_Program, $XSR_Width, $XSR_Height) ;; some programs may need to be resized XSkinReSize ( "notepad.exe", 400, 400) EndFunc ;==>CallResize Func CallRun() ;; XSkinRun( $XR_Title, $XR_Program) $Myrunner = XSkinRun ("My Notepad", "notepad.exe") $loop = 1 EndFunc ;==>CallRun Func CallInternet() ;; XSkinExplore( $XSI_Title, $XSI_Location, $XSI_Width, $XSI_Height) $Myrunner = XSkinExplore ( "My Internet", "http://www.autoitscript.com/forum/index.php?showtopic=32494", 720, 600) $loop = 1 EndFunc ;==>CallInternet Func CallHardDrive() ;; XSkinExplore( $XSI_Title, $XSI_Location, $XSI_Width, $XSI_Height) $Myrunner = XSkinExplore ( "My Programs", @ScriptDir, 600, 500) $loop = 1 EndFunc ;==>CallHardDrive Func CheckWindow() While WinExists($Myrunner[0]) And WinExists($Myrunner[1]) $XRM_msg = GUIGetMsg() If $XRM_msg = $Myrunner[2]Then ExitLoop ; exit button on parent WEnd WinClose($Myrunner[1]) ; the executed program GUIDelete($Myrunner[0]) ; the "parent" XSkin $loop = 0 EndFunc ;~ ; XSkinShell************** ; Ver 1.1.0 Autoit Ver v3.2.12.0 5/22/2008 - Requires XSkin.au3 ;#include <GUIConstantsEx.au3> ;#include-once ;#include <XSkin.au3> ;Opt("MustDeclareVars", 1) Func XSkinReSize($XRS_Program, $XSR_Width, $XSR_Height) Local $XSPID, $XhWnd = 0, $XstPID = DllStructCreate("int"), $XSWinList, $XSdll, $XPID $XSPID = Run($XRS_Program, '', @SW_HIDE) Do $XSWinList = WinList() For $i = 1 To $XSWinList[0][0] If $XSWinList[$i][0] <> "" Then DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $XSWinList[$i][1], "ptr", DllStructGetPtr($XstPID)) If DllStructGetData($XstPID, 1) = $XSPID Then $XhWnd = $XSWinList[$i][1] ExitLoop EndIf EndIf Next Sleep(20) Until $XhWnd <> 0 $XSdll = "" $XstPID = 0 If $XhWnd <> 0 Then WinMove($XhWnd, "", 200, 200, $XSR_Width, $XSR_Height) Sleep(100) WinClose($XhWnd) EndIf EndFunc ;==>XSkinReSize Func XSkinRun($XR_Title, $XR_Program = "") ; thanks holger If $XR_Program = "" Then Return Local $XhWnd = 0, $XstPID = DllStructCreate("int"), $XSWinList, $XhWinSize, $XSdll, $XPID, $XPID2, $XR_Ret[3], $Xh_ret, $oxStyle, $ostyle $XPID = Run($XR_Program, '', @SW_HIDE) Do $XSWinList = WinList() For $i = 1 To $XSWinList[0][0] If $XSWinList[$i][0] <> "" Then DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $XSWinList[$i][1], "ptr", DllStructGetPtr($XstPID)) If DllStructGetData($XstPID, 1) = $XPID Then $XhWnd = $XSWinList[$i][1] ExitLoop EndIf EndIf Next Sleep(20) Until $XhWnd <> 0 $XSdll = "" $XstPID = 0 If $XhWnd <> 0 Then $XhWinSize = WinGetPos($XhWnd) $XPID2 = XSkinGUICreate ( $XR_Title, ($XhWinSize[2]) + ($tile_size * 2) , ($XhWinSize[3]) + ($tile_size * 2), $Skin_Folder) If FileExists($Icon_Folder) Then $Xh_ret = XSkinIcon ($XPID2) $oxStyle = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $XPID2, "int", -16) DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $XPID2, "int", -16, "long", BitOR($oxStyle[0], $WS_CLIPCHILDREN)) $ostyle = DllCall("user32.dll", "long", "GetWindowLong", "hwnd", $XhWnd, "int", -16) DllCall("user32.dll", "int", "SetParent", "hwnd", $XhWnd, "hwnd", $XPID2) DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $XhWnd, "int", -16, "long", BitOR($WS_POPUP, $WS_CHILD, $WS_VISIBLE, $WS_CLIPSIBLINGS)) GUISetState() WinMove($XhWnd, "", $tile_size, $tile_size) WinSetState($XhWnd, "", @SW_SHOW) WinActivate($XhWnd) $XR_Ret[0] = $XPID2 $XR_Ret[1] = $XhWnd $XR_Ret[2] = $Xh_ret[1] Return $XR_Ret EndIf EndFunc ;==>XSkinRun Func XSkinExplore($XSI_Title, $XSI_Location, $XSI_Width, $XSI_Height) Local $oXIE, $XSI_Ret[3], $XSI_but, $XSI_gui, $oXActiveX $oXIE = ObjCreate("Shell.Explorer.2") $XSI_gui = XSkinGUICreate ($XSI_Title, $XSI_Width + ($tile_size * 2), $XSI_Height + ($tile_size * 2), $Skin_Folder) If FileExists($Icon_Folder) Then $XSI_but = XSkinIcon ($XSI_gui) $oXActiveX = GUICtrlCreateObj($oXIE, $tile_size, $tile_size, $XSI_Width, $XSI_Height) $oXIE.navigate ($XSI_Location) GUISetState() $XSI_Ret[1] = $XSI_Ret[0] $XSI_Ret[2] = $XSI_but[1] Return $XSI_Ret EndFunc ;==>XSkinExplore Link to comment Share on other sites More sharing options...
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