Jump to content
Sign in to follow this  
Zohar

[Solved] _IEAttach Succeeds but returns the wrong window handle?

Recommended Posts

Zohar

If I Open IE, navigate to some site by myself(manually), and then run this Code:

$oIE =_IEAttach("SomeURL...","url")

The attach operations Succeeds,

but when I try after that to do

WinFlash($oIE)

Or

WinActivate($oIE)

Both those functions, work on the Calling window(SciTE for example), and not on the IE window that I have just attached to.

that's despite the fact that whatever other operation I will do with $oIE, will succeed and work very well,

for example _IENavigate($oIE,$URL) will navigate with no problem.

just window operations like Activate or Flash don't work on the right window.

how can I fix this?

Edited by Zohar

Share this post


Link to post
Share on other sites
Authenticity

The problem is that you're trying to send object instance to functions that require titles or texts.

Share this post


Link to post
Share on other sites
monoceres

As the above poster mentioned you cannot use the ie object as a parameter in Win* functions. Use _IEPropertyGet to get the hwnd of the ie window instead.

Example:

#include <ie.au3>

$ie=_IEAttach("http://www.google.se/","url")
WinFlash(_IEPropertyGet($ie,"hwnd"))

:)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
Zohar

To Authenticity:

All AutoIt's Win* functions that accept a window Title, also accept an hWnd pointer.

To monoceres:

You were right!!!

I added the _IEPropertyGet($oIE,"hwnd") part, as you said, and it solved it!!!

Thank you very much! :)

I always thought that because $oIE is a "window" object, then executing Widnow functions on it should work.

I'm glad it now works

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.