Jump to content

How can I GUIGetMsg from a GUICtrlCreateObj?


 Share

Recommended Posts

Hello. Chimp Example works fine in Windows 10. Windows 7 Also work but I get some flashing white  after I start, a second later it work without flashing.

Nine Example Does not work in Windows 10 or Windows 7.  To make it work correclty on Windows 10 and Windows 7 I set FEATURE_BROWSER_EMULATION to IE10: 10001 (0x2711) and work perfect.

 

Saludos

Link to comment
Share on other sites

Here is a sample without Objevent.

#include <GUIConstantsEx.au3>
#include <IE.au3>
#include <WindowsConstants.au3>
#include <WinAPISysWin.au3>
#include <WinAPIDlg.au3>

$SD = GUICreate("Solar data", 600, 180)
$futurebutton1 = GUICtrlCreateLabel("Visit N0NBH's site for more Banners..", 460, 50, 120, 100)
GUICtrlSetFont(-1, 14, 200, 0, "Arial")

GUISetState(@SW_SHOW)

Global $oIE = _IECreateEmbedded()
Global $bUpdateTip, $bTurnOff

$IdIE = GUICtrlCreateObj($oIE, 10, 10, 435, 160)
_IENavigate($oIE, 'about:blank', 1)
_IEDocWriteHTML($oIE, _GetHTML2())
_IEAction($oIE, "refresh")
_IELoadWait($oIE)

$oDocument = $oIE.document
$oDocument.body.scroll = "no"


Local $isMsg = ""
While True
    $isMsg = GUIGetMsg()
    Switch $isMsg
        Case $GUI_Event_Close
            ExitLoop
        Case $GUI_EVENT_MOUSEMOVE
            _ShowToolTip()
        Case $GUI_EVENT_PRIMARYDOWN
            If _IsIEWindows() Then
                ShellExecute("http://www.hamqsl.com/solar.html")
            EndIf
    EndSwitch
WEnd

Func _ShowToolTip()
    If _IsIEWindows() Then
        ToolTip("Click Image to add Solar-Terrestrial Data to your website!")
    Else
        ToolTip("")
    EndIf
EndFunc   ;==>_ShowToolTip

Func _IsIEWindows()
    Local $tStruct = DllStructCreate($tagPOINT) ; Create a structure that defines the point to be checked.
    DllStructSetData($tStruct, "x", MouseGetPos(0))
    DllStructSetData($tStruct, "y", MouseGetPos(1))
    Local $hWnd = _WinAPI_WindowFromPoint($tStruct) ; Retrieve the window handle.
    ConsoleWrite($hWnd & @CRLF)
    Return _WinAPI_GetClassName($hWnd) = "Internet Explorer_Server"
EndFunc   ;==>_IsIEWindows

Func _GetHTML2()
    Local $sHTML = _
            "<!DOCTYPE HTML>" & @CRLF & _
            "<html>" & @CRLF & _
            "<head>" & @CRLF & _
            '<meta http-equiv="X-UA-Compatible" content="IE=edge" />' & @CRLF & _
            "<title>solar101pic.php (410×125)</title>" & @CRLF & _
            '</head>' & @CRLF & _
            '<body>' & @CRLF & _
            '' & @CRLF & _ ; '<body style="margin: 12px; background: #0e0e0e;">' & @CRLF & _
            '' & @CRLF & _ ; '<img id="IMG1" style="-webkit-user-select: none;margin: auto;" src="http://www.hamqsl.com/solar101pic.php">' & @CRLF & _
            '<img id="IMG1" src="http://www.hamqsl.com/solar101pic.php", style="position: absolute; left:0; top:0; width: 435px; height: 160px">' & @CRLF & _
            "</body>" & @CRLF & _
            "</html>"
    Return $sHTML
EndFunc   ;==>_GetHTML2

Saludos

Link to comment
Share on other sites

Thanks @Danyfirex, and @seadoggie01,

it seems that to make ObjEvent work IE should be downgraded to some previous version. Unfortunately (I don't know why) on my system (I think this happens also on other systems?) The use of <meta http-equiv = "X-UA-Compatible" content="IE=8"> does not have the desired effect .
I also think that downgrading IE to a previous version precludes the use of more recent HTML features.
For this reason I have devised the function _WebBrowser_JS_ElementGetRef () which, as explained in the notes of the function header, allows the use of a DOM object in the AutoIt ObjEvent function (without worrying about downgrading IE).
I don't know if this approach could have any contraindications, but in the use I made of it, I have not encountered any so far.

P.S.

8 hours ago, Danyfirex said:

Here is a sample without Objevent.

fine example Danyfirex  (....though here the goal is to use ObjEvent :))

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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...