IanN1990 Posted September 23, 2016 Share Posted September 23, 2016 Hi, This is a two part question. #NoTrayIcon #include <array.au3> #include <ie.au3> #include <WinAPI.au3> OnAutoItExitRegister("OnAutoItExit") $hGUI = GUICreate("Autoit Example", 1024, 768) $Pid = Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe -noframemerging -private -k -nosessionmerging about:blank123143", "", @SW_HIDE) ;$PID <-- Wrong PID and Window doesn't @SW_HIDE Do sleep(100) $oIE = _IEAttach("about:blank123143", "url") Until @error = 0 ;Attach was successfull _IENavigate($oIE, "google.com") $h_HWND = _IEPropertyGet($oIE, "hwnd") ;Handle of IE _WinAPI_SetParent($h_HWND, $hGUI) ;Parent _WinAPI_MoveWindow($h_HWND, 0, 0, 1024, 768, False) ;Move within GUI GUISetState() ;Show GUI sleep(2000) ;Delay Before Exit Func OnAutoItExit() WinClose($h_HWND) EndFunc Above is some code which generates IE, attaches it and puts it inside a GUI. 1. Why is the PID returned by Run incorrect? and why does @sw_hide not work 2. Is there any way to link the two processes, so IE is a child of Autoit. Meaning if autoit (parent) was to die the child dies as well Currently on the graphical side, autoit is the parent and if it dies the "visual" side of IE goes but the process is left over. (I have put in a OnExit to close it but if autoit ever crashed or user ends the process, i would have left over explorers) Link to comment Share on other sites More sharing options...
BrewManNH Posted September 23, 2016 Share Posted September 23, 2016 The PID isn't incorrect, it's just not the one for the window you're looking for, when you run IE it opens 2 instances of it, and you're only getting the PID of the first one. Instead of Run and _IEAttach, use _IECreate and set the $iVisible parameter to 0 to hide it no idea of how to make it a child process, not my forte If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
AutoBert Posted September 23, 2016 Share Posted September 23, 2016 Try _IECreateEmbedded. 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