Jump to content

GUISetOnEvent failed on IE winhandle


Recommended Posts

GUISetOnEvent failed on IE winhandle

#include <IE.au3>
#include <GUIConstants.au3>

$oIE = _IECreate()
$hIE = HWnd($oIE.HWND ())   ;winhandle of IE
$Re1 = GUISetOnEvent($GUI_EVENT_CLOSE, "IEEvent", $hIE)     ;result 0
$Re2 = GUISetOnEvent($GUI_EVENT_MINIMIZE, "IEEvent", $hIE)
$Re3 = GUISetOnEvent($GUI_EVENT_RESTORE, "IEEvent", $hIE)
$Re4 = GUISetOnEvent($GUI_EVENT_RESIZED, "IEEvent", $hIE)
$Re5 = GUISetOnEvent($GUI_EVENT_MAXIMIZE, "IEEvent", $hIE)

ConsoleWrite($Re1 & $Re2 & $Re3 & $Re4 & $Re5 & @LF)    ;00000
WinSetState($hIE, "", @SW_MAXIMIZE) ;sucessed

;not fire event
Func IEEvent()
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE
            MsgBox(0, "Close Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
            Exit
        Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE
            MsgBox(0, "Window Minimized", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
        Case @GUI_CtrlId = $GUI_EVENT_RESTORE
            MsgBox(0, "Window Restored", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
    EndSelect
EndFunc   ;==>IEEvent

my UDF:myReplaceStringInFile suport StringRegExp and subdirectorymyFileListToArray suport StringRegExp and subdirectorymyImageIdentify get all information from image, use Image Magick com supportautoit in Chinaautoit 论坛yidabu成功社区

Link to comment
Share on other sites

Closer, not exact

#include <IE.au3>
#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)        ;0=disabled, 1=OnEvent mode enabled

$hIE = _IECreateEmbedded ()
GUICreate("Embedded Web control Test", 640, 580, _
        (@DesktopWidth - 660) / 2, (@DesktopHeight - 580) / 2, _
        $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$GUIActiveX = GUICtrlCreateObj($hIE, 10, 40, 600, 360)

$Re1 = GUISetOnEvent($GUI_EVENT_CLOSE, "IEEvent", $hIE)     ;result 0
$Re2 = GUISetOnEvent($GUI_EVENT_MINIMIZE, "IEEvent", $hIE)
$Re3 = GUISetOnEvent($GUI_EVENT_RESTORE, "IEEvent", $hIE)
$Re4 = GUISetOnEvent($GUI_EVENT_RESIZED, "IEEvent", $hIE)
$Re5 = GUISetOnEvent($GUI_EVENT_MAXIMIZE, "IEEvent", $hIE)

ConsoleWrite($Re1 & $Re2 & $Re3 & $Re4 & $Re5 & @LF)    ;00000
WinSetState($hIE, "", @SW_MAXIMIZE) ;sucessed

While 1
    Sleep(20)
WEnd

;not fire event
Func IEEvent()
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE
            MsgBox(0, "Close Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
            Exit
        Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE
            MsgBox(0, "Window Minimized", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
        Case @GUI_CtrlId = $GUI_EVENT_RESTORE
            MsgBox(0, "Window Restored", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
    EndSelect
EndFunc   ;==>IEEvent

just playing.. should have an error handler, see _IECreateEmbedded ()

8)

Edited by Valuater

NEWHeader1.png

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...