Sign in to follow this  
Followers 0
Juvigy

Create a Root Menu Item in IE7+ @edit - OR a IE toolbar

5 posts in this topic

#1 ·  Posted (edited)

The only thing i could find is to create a submenu in the Tools or Help menus but cant seem to find how to do a root menu.

Found out and example of doing that with Calculator for example using _GUICtrlMenu_GetMenu and _GUICtrlMenu_CreateMenu()

but it doesnt work for IE for some reason - GetMenu fails. I am counting on Dale here as he is the expert here , but if someone

have suggestions please feel free to enlighten me.

10x .

Edited by Juvigy

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Maybe it can be done, I haven't tried, but don't be surprised if it can't.

Calculator doesn't have the thousands of man-hours of work in anti-malware and security that IE has. Lots of things don't work in IE that might work elsewhere because it has a lot more defensive measures included.

That's what necessarily comes of years as the most targeted/pwnd app of all time.

:graduated:

Edit: Quoting from KaFu's first link below:

Not all menus are accessible by your add-ons, however. Add-ons are limited to the Tools and Help menus, and to the various context menus used on a Web page. Personally, I think this is a good thing. Imagine the havoc a hacker might create if they could add items to the File menu. The user might think they are printing a Web page, when in fact they might be running malicious code inserted as an add-on.

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

I need to create a menu with submenus in IE Menubar or in the IE toolbar but cant seem to find how to do it.

Found something about visual studio but i hope there is another way.

Share this post


Link to post
Share on other sites

I tried this , but dont get any result:

Global $hReBar,$oIE,$hWndTarget,$test,$iStyle

$oIE = _IECreate("about:blank")
$hWndTarget = _IEPropertyGet ($oIE, "hwnd")
ConsoleWrite($hWndTarget&@CRLF)

$iStyle = BitOR($WS_BORDER,$WS_CHILD,$WS_CLIPCHILDREN,$WS_CLIPSIBLINGS,$WS_VISIBLE,$RBS_BANDBORDERS,$RBS_DBLCLKTOGGLE,$RBS_REGISTERDROP,$RBS_VARHEIGHT,$CCS_NODIVIDER,$CCS_NOPARENTALIGN)
;~ _WinAPI_CreateWindowEx($WS_EX_TOOLWINDOW, "TOOLBARCLASSNAME", "New toolbar", $iStyle, $iX, $iY, $iWidth, $iHeight, $hParent[, $hMenu = 0[, $hInstance = 0[, $pParam = 0]]])

$Debug_RB = False

_Main()

Func _Main()
    Local $hToolbar, $hCombo, $hDTP
    Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp
    ; create the rebar control
    $hReBar = _GUICtrlReBar_Create($hWndTarget, $iStyle)
    ConsoleWrite($hReBar&@CRLF)
    ; create a toolbar to put in the rebar
    $hToolbar = _GUICtrlToolBar_Create($hWndTarget, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))
    ConsoleWrite($hToolbar&@CRLF)
    ; Add standard system bitmaps
    Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
        Case 0
            _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
        Case 2
            _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
    EndSwitch
    ; Add buttons
    _GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
    _GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
    _GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
    _GUICtrlToolbar_AddButtonSep($hToolbar)
    _GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)
    ; create a combobox to put in the rebar
    $hCombo = _GUICtrlComboBox_Create($hWndTarget, "", 0, 0, 120)
    ConsoleWrite($hCombo&@CRLF)
    _GUICtrlComboBox_BeginUpdate($hCombo)
    _GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
    _GUICtrlComboBox_EndUpdate($hCombo)
    ; create a date time picker to put in the rebar
    $hDTP = _GUICtrlDTP_Create($hWndTarget, 0, 0, 190)
    ; default for add is append
    ; add band with control
    $test = _GUICtrlReBar_AddBand($hReBar, $hCombo, 120, 200, "Dir *.exe")
    ConsoleWrite($test&@CRLF)
    ; add band with date time picker
    $test = _GUICtrlReBar_AddBand($hReBar, $hDTP, 120)
    ConsoleWrite($test&@CRLF)
    ; add band with toolbar to begining of rebar
    $test = _GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)
    ConsoleWrite($test&@CRLF)
    $test = _WinAPI_RedrawWindow($hWndTarget,0,0,$RDW_ALLCHILDREN)
    ConsoleWrite($test&@CRLF)
EndFunc   ;==>_Main

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR
    Local $tAUTOBREAK, $tAUTOSIZE, $tNMREBAR, $tCHEVRON, $tCHILDSIZE, $tOBJECTNOTIFY

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hReBar
            Switch $iCode
                Case $RBN_AUTOBREAK
                    ; Notifies a rebar's parent that a break will appear in the bar. The parent determines whether to make the break
                    $tAUTOBREAK = DllStructCreate($tagNMREBARAUTOBREAK, $ilParam)
                    _DebugPrint("$RBN_AUTOBREAK" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tAUTOBREAK, "hWndFrom") & @LF & _
                            "-->IDFrom:" & @TAB & DllStructGetData($tAUTOBREAK, "IDFrom") & @LF & _
                            "-->Code:" & @TAB & DllStructGetData($tAUTOBREAK, "Code") & @LF & _
                            "-->uBand:" & @TAB & DllStructGetData($tAUTOBREAK, "uBand") & @LF & _
                            "-->wID:" & @TAB & DllStructGetData($tAUTOBREAK, "wID") & @LF & _
                            "-->lParam:" & @TAB & DllStructGetData($tAUTOBREAK, "lParam") & @LF & _
                            "-->uMsg:" & @TAB & DllStructGetData($tAUTOBREAK, "uMsg") & @LF & _
                            "-->fStyleCurrent:" & @TAB & DllStructGetData($tAUTOBREAK, "fStyleCurrent") & @LF & _
                            "-->fAutoBreak:" & @TAB & DllStructGetData($tAUTOBREAK, "fAutoBreak"))
                    ; Return value not used
                Case $RBN_AUTOSIZE
                    ; Sent by a rebar control created with the $RBS_AUTOSIZE style when the rebar automatically resizes itself
                    $tAUTOSIZE = DllStructCreate($tagNMRBAUTOSIZE, $ilParam)
                    _DebugPrint("$RBN_AUTOSIZE" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tAUTOSIZE, "hWndFrom") & @LF & _
                            "-->IDFrom:" & @TAB & DllStructGetData($tAUTOSIZE, "IDFrom") & @LF & _
                            "-->Code:" & @TAB & DllStructGetData($tAUTOSIZE, "Code") & @LF & _
                            "-->fChanged:" & @TAB & DllStructGetData($tAUTOSIZE, "fChanged") & @LF & _
                            "-->TargetLeft:" & @TAB & DllStructGetData($tAUTOSIZE, "TargetLeft") & @LF & _
                            "-->TargetTop:" & @TAB & DllStructGetData($tAUTOSIZE, "TargetTop") & @LF & _
                            "-->TargetRight:" & @TAB & DllStructGetData($tAUTOSIZE, "TargetRight") & @LF & _
                            "-->TargetBottom:" & @TAB & DllStructGetData($tAUTOSIZE, "TargetBottom") & @LF & _
                            "-->ActualLeft:" & @TAB & DllStructGetData($tAUTOSIZE, "ActualLeft") & @LF & _
                            "-->ActualTop:" & @TAB & DllStructGetData($tAUTOSIZE, "ActualTop") & @LF & _
                            "-->ActualRight:" & @TAB & DllStructGetData($tAUTOSIZE, "ActualRight") & @LF & _
                            "-->ActualBottom:" & @TAB & DllStructGetData($tAUTOSIZE, "ActualBottom"))
                    ; Return value not used
                Case $RBN_BEGINDRAG
                    ; Sent by a rebar control when the user begins dragging a band
                    $tNMREBAR = DllStructCreate($tagNMREBAR, $ilParam)
                    _DebugPrint("$RBN_BEGINDRAG" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMREBAR, "hWndFrom") & @LF & _
                            "-->IDFrom:" & @TAB & DllStructGetData($tNMREBAR, "IDFrom") & @LF & _
                            "-->Code:" & @TAB & DllStructGetData($tNMREBAR, "Code") & @LF & _
                            "-->dwMask:" & @TAB & DllStructGetData($tNMREBAR, "dwMask") & @LF & _
                            "-->uBand:" & @TAB & DllStructGetData($tNMREBAR, "uBand") & @LF & _
                            "-->fStyle:" & @TAB & DllStructGetData($tNMREBAR, "fStyle") & @LF & _
                            "-->wID:" & @TAB & DllStructGetData($tNMREBAR, "wID") & @LF & _
                            "-->lParam:" & @TAB & DllStructGetData($tNMREBAR, "lParam"))
                    Return 0 ; to allow the rebar to continue the drag operation
;~                  Return 1 ; nonzero to abort the drag operation
                Case $RBN_CHEVRONPUSHED
                    ; Sent by a rebar control when a chevron is pushed
                    ; When an application receives this notification, it is responsible for displaying a popup menu with items for each hidden tool.
                    ; Use the rc member of the NMREBARCHEVRON structure to find the correct position for the popup menu
                    $tCHEVRON = DllStructCreate($tagNMREBARCHEVRON, $ilParam)
                    _DebugPrint("$RBN_CHEVRONPUSHED" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tCHEVRON, "hWndFrom") & @LF & _
                            "-->IDFrom:" & @TAB & DllStructGetData($tCHEVRON, "IDFrom") & @LF & _
                            "-->Code:" & @TAB & DllStructGetData($tCHEVRON, "Code") & @LF & _
                            "-->uBand:" & @TAB & DllStructGetData($tCHEVRON, "uBand") & @LF & _
                            "-->wID:" & @TAB & DllStructGetData($tCHEVRON, "wID") & @LF & _
                            "-->lParam:" & @TAB & DllStructGetData($tCHEVRON, "lParam") & @LF & _
                            "-->Left:" & @TAB & DllStructGetData($tCHEVRON, "Left") & @LF & _
                            "-->Top:" & @TAB & DllStructGetData($tCHEVRON, "Top") & @LF & _
                            "-->Right:" & @TAB & DllStructGetData($tCHEVRON, "Right") & @LF & _
                            "-->lParamNM:" & @TAB & DllStructGetData($tCHEVRON, "lParamNM"))
                    ; Return value not used
                Case $RBN_CHILDSIZE
                    ; Sent by a rebar control when a band's child window is resized
                    $tCHILDSIZE = DllStructCreate($tagNMREBARCHILDSIZE, $ilParam)
                    _DebugPrint("$RBN_CHILDSIZE" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tCHILDSIZE, "hWndFrom") & @LF & _
                            "-->IDFrom:" & @TAB & DllStructGetData($tCHILDSIZE, "IDFrom") & @LF & _
                            "-->Code:" & @TAB & DllStructGetData($tCHILDSIZE, "Code") & @LF & _
                            "-->uBand:" & @TAB & DllStructGetData($tCHILDSIZE, "uBand") & @LF & _
                            "-->wID:" & @TAB & DllStructGetData($tCHILDSIZE, "wID") & @LF & _
                            "-->CLeft:" & @TAB & DllStructGetData($tCHILDSIZE, "CLeft") & @LF & _
                            "-->CTop:" & @TAB & DllStructGetData($tCHILDSIZE, "CTop") & @LF & _
                            "-->CRight:" & @TAB & DllStructGetData($tCHILDSIZE, "CRight") & @LF & _
                            "-->CBottom:" & @TAB & DllStructGetData($tCHILDSIZE, "CBottom") & @LF & _
                            "-->BLeft:" & @TAB & DllStructGetData($tCHILDSIZE, "BandLeft") & @LF & _
                            "-->BTop:" & @TAB & DllStructGetData($tCHILDSIZE, "BTop") & @LF & _
                            "-->BRight:" & @TAB & DllStructGetData($tCHILDSIZE, "BRight") & @LF & _
                            "-->BBottom:" & @TAB & DllStructGetData($tCHILDSIZE, "BBottom"))
                    ; Return value not used
                Case $RBN_DELETEDBAND
                    ; Sent by a rebar control after a band has been deleted
                    $tNMREBAR = DllStructCreate($tagNMREBAR, $ilParam)
                    _DebugPrint("$RBN_DELETEDBAND" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMREBAR, "hWndFrom") & @LF & _
                            "-->IDFrom:" & @TAB & DllStructGetData($tNMREBAR, "IDFrom") & @LF & _
                            "-->Code:" & @TAB & DllStructGetData($tNMREBAR, "Code") & @LF & _
                            "-->dwMask:" & @TAB & DllStructGetData($tNMREBAR, "dwMask") & @LF & _
                            "-->uBand:" & @TAB & DllStructGetData($tNMREBAR, "uBand") & @LF & _
                            "-->fStyle:" & @TAB & DllStructGetData($tNMREBAR, "fStyle") & @LF & _
                            "-->wID:" & @TAB & DllStructGetData($tNMREBAR, "wID") & @LF & _
                            "-->lParam:" & @TAB & DllStructGetData($tNMREBAR, "lParam"))
                    ; Return value not used
                Case $RBN_DELETINGBAND
                    ; Sent by a rebar control when a band is about to be deleted
                    $tNMREBAR = DllStructCreate($tagNMREBAR, $ilParam)
                    _DebugPrint("$RBN_DELETINGBAND" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMREBAR, "hWndFrom") & @LF & _
                            "-->IDFrom:" & @TAB & DllStructGetData($tNMREBAR, "IDFrom") & @LF & _
                            "-->Code:" & @TAB & DllStructGetData($tNMREBAR, "Code") & @LF & _
                            "-->dwMask:" & @TAB & DllStructGetData($tNMREBAR, "dwMask") & @LF & _
                            "-->uBand:" & @TAB & DllStructGetData($tNMREBAR, "uBand") & @LF & _
                            "-->fStyle:" & @TAB & DllStructGetData($tNMREBAR, "fStyle") & @LF & _
                            "-->wID:" & @TAB & DllStructGetData($tNMREBAR, "wID") & @LF & _
                            "-->lParam:" & @TAB & DllStructGetData($tNMREBAR, "lParam"))
                    ; Return value not used
                Case $RBN_ENDDRAG
                    ; Sent by a rebar control when the user stops dragging a band
                    $tNMREBAR = DllStructCreate($tagNMREBAR, $ilParam)
                    _DebugPrint("$RBN_ENDDRAG" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMREBAR, "hWndFrom") & @LF & _
                            "-->IDFrom:" & @TAB & DllStructGetData($tNMREBAR, "IDFrom") & @LF & _
                            "-->Code:" & @TAB & DllStructGetData($tNMREBAR, "Code") & @LF & _
                            "-->dwMask:" & @TAB & DllStructGetData($tNMREBAR, "dwMask") & @LF & _
                            "-->uBand:" & @TAB & DllStructGetData($tNMREBAR, "uBand") & @LF & _
                            "-->fStyle:" & @TAB & DllStructGetData($tNMREBAR, "fStyle") & @LF & _
                            "-->wID:" & @TAB & DllStructGetData($tNMREBAR, "wID") & @LF & _
                            "-->lParam:" & @TAB & DllStructGetData($tNMREBAR, "lParam"))
                    ; Return value not used
                Case $RBN_GETOBJECT
                    ; Sent by a rebar control created with the $RBS_REGISTERDROP style when an object is dragged over a band in the control
                    $tOBJECTNOTIFY = DllStructCreate($tagNMOBJECTNOTIFY, $ilParam)
                    _DebugPrint("$RBN_GETOBJECT" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "hWndFrom") & @LF & _
                            "-->IDFrom:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "IDFrom") & @LF & _
                            "-->Code:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "Code") & @LF & _
                            "-->Item:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "Item") & @LF & _
                            "-->piid:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "piid") & @LF & _
                            "-->pObject:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "pObject") & @LF & _
                            "-->Result:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "Result"))
                    ; Return value not used
                Case $RBN_HEIGHTCHANGE
                    ; Sent by a rebar control when its height has changed
                    ; Rebar controls that use the $CCS_VERT style send this notification message when their width changes
                    _DebugPrint("$RBN_HEIGHTCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode)
                    ; Return value not used
                Case $RBN_LAYOUTCHANGED
                    ; Sent by a rebar control when the user changes the layout of the control's bands
                    _DebugPrint("$RBN_LAYOUTCHANGED" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode)
                    ; Return value not used
                Case $RBN_MINMAX
                    ; Sent by a rebar control prior to maximizing or minimizing a band
                    _DebugPrint("$RBN_MINMAX" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode)
;~                  Return 1 ; a non-zero value to prevent the operation from taking place
                    Return 0 ; zero to allow it to continue
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
    ConsoleWrite( _
            "!===========================================================" & @LF & _
            "+======================================================" & @LF & _
            "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
            "+======================================================" & @LF)
EndFunc   ;==>_DebugPrint

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