Page 1 of 1

How to open a webpage with InPrivate?

Posted: 04 Oct 2019, 06:22
by afe

I tried the following, but an Error: 0x80010108 error occurred.

Code: Select all

ie := ComObjCreate("InternetExplorer.Application")
ie.Visible := true
WinWait, % "ahk_id " ie.hwnd
PostMessage, 0x111, 0x8, 0,, % "ahk_id " ie.hwnd

Re: How to open a webpage with InPrivate?

Posted: 08 Oct 2019, 21:25
by knoxastic
I don't know about the error you get, but I think there's no way to handle InPrivate windows from IE's objects. Here's a workaround that runs IE InPrivate mode and then uses ShellWindows to get the IE object.

Code: Select all

Run, iexplore.exe -private								; Run IE InPrivate mode

; Sleep 1000											; Wait for IE to finish loading

obj := ComObjCreate("Shell.Application").Windows		; Create a ShellWindows object to get the open windows

for window in obj {										; Look for IE's window
	if (window.Name = "Internet Explorer") {
		ie := window									; Get the InPrivate window

I had to use the Sleep command because WinWait wasn't working and sometimes ShellWindows coulnd't get the IE window.

Re: How to open a webpage with InPrivate?

Posted: 08 Oct 2019, 22:24
by Masonjar13
This pretty much is exactly what knoxastic is doing, but in a more isolated manner. Unfortunately flashes the window though, I've never been able to get around that.

If you don't feel like dissecting it, here's an example to use the object.

Code: Select all

ie:=new IEObj
And of course, you can always access the COM obj directly with ie.wb.