Sign in to follow this  
Followers 0
Kogmedia

_IECreate User Closes Object?

2 posts in this topic

#1 ·  Posted (edited)

Hello,

I have a $oIE _IECreate window on a website how do i detect the browser has been closed by the user?

Thanks

Edited by Kogmedia

[font="Verdana"]Keith (Kogmedia)[/font]My ScriptQuick Search - Internet / Hard Drive Search

Share this post


Link to post
Share on other sites



You could do something like this...

#include <IE.au3>

$sURL = "www.google.com"
$oIE = _IECreate($sURL)
AdlibEnable("_IsClosedIE")

While 1
    If _IsClosedIE($oIE) Then
        ConsoleWrite("User has closed the browser!" & @CR)
        Exit
    EndIf
    Sleep(100)
WEnd

Func _IsClosedIE($o_IE)
    $fNotify = _IEErrorNotify()
    _IEErrorNotify(0)
    _IEPropertyGet($o_IE, "HWND")
    _IEErrorNotify($fNotify)
    If $IEComErrorNumber = -2147417848 Then
        Return 1
    EndIf
    Return 0
EndFunc   ;==>_IsClosedIE

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  
Followers 0