Jump to content

İe menu with guıcontrol not working


Go to solution Solved by UEZ,

Recommended Posts

control input vs. the materials are not working. With the ie menu
ie menus I want to use .
ie menus works
notepad ,calc , about, exit
.but guıcontrol     inputbox , button etc dont work ,what should I do?

thank you now

#include <IE.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
  #include <Process.au3>
  If UBound(ProcessList(@ScriptName)) > 2 Then Exit
OnAutoItExitRegister("_IE_Embedded_unregistry")
  RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION', _ProcessGetName(@AutoItPID),"REG_DWORD",0x00002af9)
 Global $Form1 = GUICreate("by @mesale0077", 680, 470, -1, -1)
 $Label1 = GUICtrlCreateLabel("KCYNSY :", 68, 16, 112, 17)
    $Label2 = GUICtrlCreateLabel("SCYNSY :", 68, 60, 120, 17)
    GUICtrlSetLimit(-1, 2)
    $Input2 = GUICtrlCreateInput("3", 192, 56, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER))
    GUICtrlSetLimit(-1, 2)
    $Input1 = GUICtrlCreateInput("1", 192, 16, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER))
    $Button1 = GUICtrlCreateButton("CLİCK ME", 256, 24, 57, 41, $WS_GROUP)
    GUICtrlSetCursor(-1, 0)
    $Label3 = GUICtrlCreateLabel("Hazyrlayan: @mesale0077", 176, 88, 144, 17)
GUISetState()
Global $hGUI = GUICreate("",684, 468, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $Form1)
$oIE = _IECreateEmbedded()
$Obj_RCV = GUICtrlCreateObj($oIE, 0, 0, 684, 468)
Local $oDocEvents = ObjEvent($oIE.document, "Event_", "HTMLDocumentEvents2")
#forceref $oDocEvents
_IENavigate($oIE, @ScriptDir&"\index.html")
    _HideScroll($oIE)
Local $oEventsDoc = ObjEvent($oIE.document, "Event_", "HTMLDocumentEvents2")
    #forceref $oEventsDoc
_API_SetLayeredWindowAttributes($hGUI,0xb0c4de,255)
_IEAction($oIE, "refresh")
_IELoadWait($oIE)
GUISetState()
#region - GUI SelectLoop
While 1
    $extMsg = GUIGetMsg()
    Switch $extMsg
    Case  $GUI_EVENT_CLOSE
RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION', _ProcessGetName(@AutoItPID))
  Exit
        Case $Button1
            msgbox(0,"","helloword")
    EndSwitch
WEnd
 Func _HideScroll($Temp_Object)
    Local $hText = 'var temp_h1 = document.body.clientHeight;'& _
    'var temp_h2 = document.documentElement.clientHeight;'& _
    'var isXhtml = (temp_h2<=temp_h1&&temp_h2!=0)?true:false;'& _
    'var htmlbody = isXhtml?document.documentElement:document.body;'& _
    'htmlbody.style.overflow = "hidden";'
    $Temp_Object.document.parentwindow.execscript($hText,"javascript")
    EndFunc
volatile Func Event_onclick($oEvtObj)
    If IsObj($oEvtObj) Then
        Local $oElem = $oEvtObj.srcElement
        If Not IsObj($oElem) Then Return
       Local $nId = $oElem.id
        Switch $nId
            Case "Notepad"
                run("notepad.exe")
            Case "Hesapmakinası"
                run("calc.exe")
            Case "hakkında"
              $oIE.document.parentwindow.execScript('$.fn.jAlert({ "title": "Hakkında", "message": "Mesale0077 tarafından yapılmıştır.!", "theme":"dark" });')
            Case "çıkış"
                    RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION', _ProcessGetName(@AutoItPID))
                Exit
        EndSwitch
    EndIf
EndFunc
Volatile Func Event_oncontextmenu($oEvtObj)
    If IsObj($oEvtObj) Then $oEvtObj.returnValue = False
EndFunc
Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)
    Local Const $AC_SRC_ALPHA = 1
    Local Const $ULW_ALPHA = 2
    Local Const $LWA_ALPHA = 0x2
    Local Const $LWA_COLORKEY = 0x1
    If Not $isColorRef Then
        $i_transcolor = Hex(String($i_transcolor), 6)
        $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
    EndIf
    Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA)
    Select
        Case @error
            Return SetError(@error, 0, 0)
        Case $Ret[0] = 0
            Return SetError(4, 0, 0)
        Case Else
            Return 1
    EndSelect
EndFunc
Func _IE_Embedded_unregistry()
     RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION', _ProcessGetName(@AutoItPID))
  endfunc
Edited by mesale0077
Link to comment
Share on other sites

  • Solution

The issue is that the child window overlaps the parent GUI. Thus you cannot click through the child window. Btw, with Win8 you can click through the child window.

As a workaround you can use GUIGetCursorInfo() to check whether your mouse is hovering the controls.

Something like this here:

#AutoIt3Wrapper_Version=b
#include <IE.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Process.au3>
#include <WinAPI.au3>
If UBound(ProcessList(@ScriptName)) > 2 Then Exit
OnAutoItExitRegister("_IE_Embedded_unregistry")
RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION', _ProcessGetName(@AutoItPID), "REG_DWORD", 0x00002af9)
Global $Form1 = GUICreate("by @mesale0077", 680, 470, -1, -1)
GUISetBkColor(0xb0c4de, $Form1)
$Label1 = GUICtrlCreateLabel("KCYNSY :", 68, 16, 112, 17)
$Label2 = GUICtrlCreateLabel("SCYNSY :", 68, 60, 120, 17)
$Input2 = GUICtrlCreateInput("3", 192, 56, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER))
GUICtrlSetLimit(-1, 2)
$Input1 = GUICtrlCreateInput("1", 192, 16, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER))
GUICtrlSetLimit(-1, 2)
$Button1 = GUICtrlCreateButton("CLİCK ME", 256, 24, 57, 41, $WS_GROUP)
GUICtrlSetCursor(-1, 0)
$Label3 = GUICtrlCreateLabel("Hazyrlayan: @mesale0077", 176, 88, 144, 17)
Global $hGUI = GUICreate("", 684, 468, 0, 0, $WS_POPUP, BitOR(0, $WS_EX_LAYERED, $WS_EX_MDICHILD), $Form1)
GUISetBkColor(0xb0c4de, $hGUI)
$oIE = _IECreateEmbedded()
$Obj_RCV = GUICtrlCreateObj($oIE, 0, 0, 684, 468)
Local $oDocEvents = ObjEvent($oIE.document, "Event_", "HTMLDocumentEvents2")
#forceref $oDocEvents
_IENavigate($oIE, @ScriptDir & "\index.html")
_HideScroll($oIE)
Local $oEventsDoc = ObjEvent($oIE.document, "Event_", "HTMLDocumentEvents2")
#forceref $oEventsDoc
_IEAction($oIE, "refresh")
_IELoadWait($oIE)
GUISetState(@SW_SHOWNA, $hGUI)
GUISetState(@SW_SHOW, $Form1)
_API_SetLayeredWindowAttributes($hGUI, 0xb0c4de, 0xC0)

#Region - GUI SelectLoop
While 1
    $extMsg = GUIGetMsg()
    Switch $extMsg
        Case $GUI_EVENT_CLOSE
            RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION', _ProcessGetName(@AutoItPID))
            Exit
        Case $Button1
            MsgBox(0, "", "helloword")
    EndSwitch
    $a = GUIGetCursorInfo($Form1)
    Switch $a[2]
        Case 1
            Switch $a[4]
                Case $Input1, $Input2
                    ControlFocus($Form1, "", $a[4])
                Case $Button1
                    ControlClick($Form1, "", $Button1)
                    GUISwitch($Form1)
            EndSwitch
    EndSwitch
WEnd
Func _HideScroll($Temp_Object)
    Local $hText = 'var temp_h1 = document.body.clientHeight;' & _
            'var temp_h2 = document.documentElement.clientHeight;' & _
            'var isXhtml = (temp_h2<=temp_h1&&temp_h2!=0)?true:false;' & _
            'var htmlbody = isXhtml?document.documentElement:document.body;' & _
            'htmlbody.style.overflow = "hidden";'
    $Temp_Object.document.parentwindow.execscript($hText, "javascript")
EndFunc   ;==>_HideScroll
Volatile Func Event_onclick($oEvtObj)
    If IsObj($oEvtObj) Then
        Local $oElem = $oEvtObj.srcElement
        If Not IsObj($oElem) Then Return
        Local $nId = $oElem.id
        Switch $nId
            Case "Notepad"
                Run("notepad.exe")
            Case "Hesapmakinası"
                Run("calc.exe")
            Case "hakkında"
                $oIE.document.parentwindow.execScript('$.fn.jAlert({ "title": "Hakkında", "message": "Mesale0077 tarafından yapılmıştır.!", "theme":"dark" });')
            Case "çıkış"
                RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION', _ProcessGetName(@AutoItPID))
                Exit
        EndSwitch
    EndIf
EndFunc   ;==>Event_onclick
Volatile Func Event_oncontextmenu($oEvtObj)
    If IsObj($oEvtObj) Then $oEvtObj.returnValue = False
EndFunc   ;==>Event_oncontextmenu
Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)
    Local Const $AC_SRC_ALPHA = 1
    Local Const $ULW_ALPHA = 2
    Local Const $LWA_ALPHA = 0x2
    Local Const $LWA_COLORKEY = 0x1
    If Not $isColorRef Then
        $i_transcolor = Hex(String($i_transcolor), 6)
        $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
    EndIf
    Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA)
    Select
        Case @error
            Return SetError(@error, 0, 0)
        Case $Ret[0] = 0
            Return SetError(4, 0, 0)
        Case Else
            Return 1
    EndSelect
EndFunc   ;==>_API_SetLayeredWindowAttributes
Func _IE_Embedded_unregistry()
    RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION', _ProcessGetName(@AutoItPID))
EndFunc   ;==>_IE_Embedded_unregistry

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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