I have an application which runs in the background and occasionally creates a hidden IE object. Whenever this object is created tho it causes the window I was viewing to lose focus. Is there a way to make it so whenever it creates an IE object it doesn’t cause my current window to lose focus?
oIE = CreateObject("InternetExplorer.Application")
oIE.Visible = False
No, this is being controlled by the OS…
CreateObject()creates a COM object, which in this case is the full-blown IE app. Behind the scenes, COM is calling into the object you’re creating, which is launching a browser window. There are no parameters you can pass toCreateObject(), because this call literally has no control over what the instantiated COM object does.However, the OS has a setting to disable windows from stealing focus when they are launched… this is what you need.
http://pcsupport.about.com/od/windowsxp/ht/stealingfocus02.htm – link with instructions to disable this.
If you’re still using XP, you can download a tool called TweakUI that will let you set this.
HTH,
James