wakamura Posted August 2, 2010 Share Posted August 2, 2010 I've searched everywhere and I can not find not even a clue where to begin. What I want to do is have a program open up in a GUI window that I created. I've learned everything by myself by checking out Help in AUTOIT and visiting this forum but I just cant figure out how to do this. I started on Autoit about a week ago and I've learned so much. I dont ask anyone to put out the script for me but to point out where to go because I am so lost right now. Link to comment Share on other sites More sharing options...
JohnOne Posted August 2, 2010 Share Posted August 2, 2010 I can see you are lost. But you will need to give a better explanation of what your goal is, because your post does not say much at all. Showing the code you have created with comments of what you need to do wouldnt harm your plight either. Welcome to the forums. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
wakamura Posted August 2, 2010 Author Share Posted August 2, 2010 (edited) Well all I wanted is a game to appear in my GUI. The same way as making your own browser with this, but instead of a browser the game. #include <GUIConstants.au3> #include <IE.au3> $GUI = GUICreate("Simple Web Browser", 800, 450) $object = ObjCreate("Shell.Explorer.2") $object_ctrl = GUICtrlCreateObj($object, 16, 10, 780, 400) $url_button = GUICtrlCreateButton("URL", 16, 410, 750, 25, 0) _IENavigate($object, "www.google.com") GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $url_button $URL = Inputbox("Web Browser", "Enter the URL you want to visit.") _IENavigate($Object, $URL) Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd I did not create that, I found that on the web when I was doing some searching. I thought that ObjCreate would have been my way, but after hours of testing I was still lost. Edited August 2, 2010 by wakamura Link to comment Share on other sites More sharing options...
JohnOne Posted August 2, 2010 Share Posted August 2, 2010 Straight from the helpfilesexpandcollapse popup; ******************************************************* ; Example 1 - Trap COM errors so that 'Back' and 'Forward' ; outside of history bounds does not abort script ; (expect COM errors to be sent to the console) ; ******************************************************* ; #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> _IEErrorHandlerRegister () $oIE = _IECreateEmbedded () GUICreate("Embedded Web control Test", 640, 580, _ (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _ $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) $GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360) $GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30) $GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30) $GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30) $GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30) GUISetState() ;Show GUI _IENavigate ($oIE, "http://www.autoitscript.com") ; Waiting for user to close the window While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GUI_Button_Home _IENavigate ($oIE, "http://www.autoitscript.com") Case $msg = $GUI_Button_Back _IEAction ($oIE, "back") Case $msg = $GUI_Button_Forward _IEAction ($oIE, "forward") Case $msg = $GUI_Button_Stop _IEAction ($oIE, "stop") EndSelect WEnd GUIDelete() Exit AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
wakamura Posted August 2, 2010 Author Share Posted August 2, 2010 I already know how to get a browser but what I wanted wanted was so I can open up a game inside. Like a .exe file. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 2, 2010 Share Posted August 2, 2010 I think you mean _WinAPI_SetParent(). Here's a short example: #Include <WinAPI.au3> $gui = GUICreate("something", 640, 480) GUISetState() Run("calc.exe") WinWait("Calculator") $calculator = WinGetHandle("Calculator") ;You probably need to change this if you don't have english Win7 _WinAPI_SetParent($calculator, $gui) WinMove($calculator, "", 100, 100) Do Sleep(10) Until GUIGetMsg() = -3 ;$GUI_EVENT_CLOSE = -3 .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
wakamura Posted August 2, 2010 Author Share Posted August 2, 2010 Thank you. I'll see what I can get. If I encounter any trouble I'll post here. Thnx Link to comment Share on other sites More sharing options...
wakamura Posted August 2, 2010 Author Share Posted August 2, 2010 (edited) Well, I did what you said and it worked. Although there is only 1 problem. When I run the script it works like a charm, but when I close it and run again, the process of the game keeps running when I close the script. I have tried to do this: #Include <WinAPI.au3> $gui = GUICreate("ProjecteQ",830, 643) GUISetState() Run (@ProgramFilesDir & "\Game\files\test.exe") WinWait("test") If Not WinActive("test") Then MsgBox("","Error","Game not loaded") EndIf $game = WinGetHandle("test") _WinAPI_SetParent($game, $gui) WinMove($game, "",100,100) GUISetState(@SW_SHOW,$game) Do Sleep(100) Until GUIGetMsg() = -3 If GUIGetMsg() = -3 Then _WinAPI_CloseHandle($game) ProcessClose($game) EndIf But it still wont close the process. I tried both _WinAPI_CloseHandle and ProcessClose. EDIT: Nevermind. I got it to work, it was right in my face. Do Sleep(100) Until GUIGetMsg() = -3 If WinActivate("test") Then WinClose("test") EndIf Edited August 2, 2010 by wakamura Link to comment Share on other sites More sharing options...
Bert Posted August 2, 2010 Share Posted August 2, 2010 Is this game a flash game? The Vollatran project My blog: http://www.vollysinterestingshit.com/ 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