#Region - TimeStamp ; 2012-07-15 15:10:59 v 0.9 #EndRegion - TimeStamp #Include #Include #Include #Include #Include #Include #include ; ====================================================================================================== ; FUNCTIONS ; ; _GUICtrlOwnContext_Startup Initialize Functions ; _GUICtrlOwnContext_Shutdown Close Ressources, automatically on AutoIt Exit ; _GUICtrlOwnContext_Create Create (Context)Menu ; _GUICtrlOwnContext_AddItem Create Menu-Item (Default-Item, Checkbox-Item, Radio-Item, Shape) ; _GUICtrlOwnContext_AddImage Create Menu-Item with Image (icon, jpg/gif/bmp, colored squares) ; _GUICtrlOwnContext_ShowFlag Condition to show Menu (True/False) ; _GUICtrlOwnContext_SetHoverColor Sets custom hover color ; ====================================================================================================== OnAutoItExitRegister('_GUICtrlOwnContext_Shutdown') Global Const $__HC_ACTION = 0 Global $__hGUI_OWNCONTEXTMNU, $__hWIN_PROC, $__hHOOK_PROC Global $__hSTUB__MouseProc, $__hMOD, $__hHOOK Global $__aHWND_MNU[1][8] ; [[hWnd-ParentCtrl, hWnd-Menu, fCondition, Item-Array, Shape-counter, Margin, Width, HoverColor]] --- Item-Array: [[counter], [fIsRadio], [ID1, iType, IDArrow, hSub, iTop, RECTcurrPos], [ID2, iType, ....], [..]] Global $__aHWND_SUBMNU[1][9] ; [[hWnd-ParentMenu, hWnd-Menu, fCondition, Item-Array, Shape-counter, Margin, Width, HoverColor, ID-ParentItem]] --- Item-Array: [[counter], [fIsRadio], [ID1, iType, empty, empty, iTop, RECTcurrPos], [ID2, iType, ....], [..]] Global $__iMNU_DEF_HOVERCOLOR = 0xEFFFFF Global $__iMNU_DEF_WIDTH = 200 Global $__iMNU_DEF_HEIGHT = 23 Global $__iMNU_DEF_MARGIN = 10 Global $__iMNU_DEF_LABELSHIFT = 4 Global $__iMNU_DEF_SHAPEHEIGHT = 3 Global $__hCURRENT_ACTIVE_MNU = 0 Global $__hCURRENT_ACTIVE_SUB = 0 Global $__sPath = @TempDir & "\", $__bData[3] = [2] ; arrow_right_disable.ico $__bData[1] &= "0x00000100040008110000010020008C020000460000000811000001000800F4040000D2020000101000000100200068040000C60700001010000001000800680500002E0C0000280000000800000022000000010020000000000040040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FEFEFE09FFFFFF0100000000FFFFFF01FFFFFF01FFFFFF010000000000000000FFFFFFFFFFFFFFFFFFFFFF03FFFFFF01FFFFFF01FFFFFF060000000000000000FFFFFFFFB5B5B5FFFFFFFFFFD0D0D00BFFFFFF0100000000FFFFFF0100000000FFFFFFFFB5B5B5FFB5B5B5FFFFFFFFFFCCCCCC050000000000000000FFFFFF03FFFFFFFFB5B5B5FFB5B5B5FFB5B5B5FFFFFFFFFFFFFFFF0300000000FFFFFF01FFFFFFFFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFFFFFFFFFFFFFFF0200000000FFFFFFFFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFFFFFFFFFFFFFFF05FFFFFFFFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFFFFFFFFFFFFFFFFFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFFFFFFFFFFFFFFF01FFFFFFFFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFFFFFFFFFFFFFFF0100000000FFFFFFFFB5B5B5FFB5B5B5FFB5B5B5FFFFFFFFFFFFFFFF0200000000FFFFFF01FFFFFFFFB5B5B5FFB5B5B5FFFFFFFFFFFFFFFF0300000000FFFFFF01FFFFFF03FFFFFFFFB5B5B5FFFFFFFFFF000000000000000000000000FFFFFF0400000000FFFFFFFFFFFFFFFFFFFFFF0200000000FFFFFF01FFFFFF010000000000000000FFFFFF01FFFFFF01FFFFFF03FFFFFF02FFFFFF01FFFFFF010000000000000000FFFFFF010000000000000000FFFFFF01FFFFFF02000000000000000000000000FF000000FF0000003F0000001F0000000F000000070000000300000001000000000000000100000003000000070000000F0000001F0000003F000000FF000000FF00000028000000080000002200000001000800000000001001000000000000000000000000000000000000000000FFB5B5B5FFD7D7D7FFD9D9D9FFDEDEDEFFE2E2E2FFE4E4E4FFE6E6E6FFE7E7E7FFEAEAEAFFEDEDEDFFF0F0F0FFF1F1F1FFF2F2F2FFF3F3F3FFF5F5F5FFF7F7F7FFF8F8F8FFF9F9F9FFFAFAFAFFFBFBFBFFFDFDFDFFFEFEFEFFFFFFFFFF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF130E0E10151700000D06080C12151700171702080E13160017011703090F141717010117040A10151701010117050B11170101010117070E170101010101170A1701010101010117170101010101170A170101010117070E1701010117050B1117010117040A101517011703090F1417171702080E1316000D06080C12151700130E0E1015170000FF000000FF0000003F0000001F0000000F000000070000000300000001000000000000000100000003000000070000000F0000001F0000003F000000FF000000FF000000280000001000000020" $__bData[1] &= "0000000100200000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F7F7F720FFFFFF1EFEFEFE1BFEFEFE13FFFFFF0600000000FFFFFF01FFFFFF01FFFFFF01FFFFFF01FFFFFF01FFFFFF0100000000000000000000000000000000FFFFFFFFFCFCFCFFF6F6F6FFF2F2F2CAF7F7F760F7F7F720FEFEFE0DFFFFFF02FFFFFF01FFFFFF02FFFFFF04FFFFFF04FFFFFF01000000000000000000000000FFFFFFFFECECECFFC7C7C7FFC3C3C3FFE0E0E0FFEEEEEECFF3F3F370F9F9F931FEFEFE12FFFFFF010000000000000000FFFFFF01FFFFFF01FFFFFF01FFFFFF01FFFFFFFFECECECFFC7C7C7FFB5B5B5FFB5B5B5FFC2C2C2FFDCDCDCFFEBEBEBD2F2F2F278FEFEFE39FEFEFE13FFFFFF0100000000FFFFFF01FFFFFF02FFFFFF02FFFFFFFFECECECFFC7C7C7FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFC1C1C1FFD9D9D9FFE8E8E8D6F1F1F183FEFEFE43FEFEFE17FFFFFF01FFFFFF01FFFFFF01FFFFFFFFECECECFFC7C7C7FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFBFBFBFFFD5D5D5FFE3E3E3D9F0F0F08EFEFEFE4FFEFEFE1CFFFFFF02FFFFFFFFECECECFFC7C7C7FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFBEBEBEFFD2D2D2FFE1E1E1DEF0F0F09BFEFEFE7AFFFFFFFFECECECFFC7C7C7FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFBEBEBEFFD2D2D2FFE0E0E0DDF0F0F09AFFFFFF78FFFFFFFFECECECFFC7C7C7FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFBFBFBFFFD5D5D5FFE3E3E3D9F0F0F08EFEFEFE4EFEFEFE1A00000000FFFFFFFFECECECFFC7C7C7FFB5B5B5FFB5B5B5FFB5B5B5FFB5B5B5FFC1C1C1FFD9D9D9FFE8E8E8D5F1F1F182FEFEFE43FEFEFE1700000000FFFFFF01FFFFFF01FFFFFFFFECECECFFC7C7C7FFB5B5B5FFB5B5B5FFC2C2C2FFDCDCDCFFEBEBEBD2F2F2F277FEFEFE38FEFEFE13FFFFFF01FFFFFF01FFFFFF01FFFFFF02FFFFFF02FFFFFFFFECECECFFC7C7C7FFC3C3C3FFE0E0E0FFEEEEEECDF5F5F56AFEFEFE2AFEFEFE0E0000000000000000FFFFFF01FFFFFF03FFFFFF03FFFFFF01FFFFFF01FFFFFFFFFCFCFCFFF6F6F6FFF2F2F2CAF6F6F65FFEFEFE1FFFFFFF0A00000000FFFFFF01FFFFFF01FFFFFF01FFFFFF01FFFFFF01000000000000000000000000FEFEFE19FEFEFE19FEFEFE19FEFEFE13FFFFFF08FFFFFF03FFFFFF02FFFFFF02FFFFFF01FFFFFF01FFFFFF01FFFFFF0100000000000000000000000000000000FFFFFF01FFFFFF0100000000000000000000000000000000FFFFFF01FFFFFF01FFFFFF02FFFFFF01FFFFFF010000000000000000000000000000000000000000FFFF0000FFFF00000FFF000003FF000000FF0000001F000000070000000100000001000000070000001F000000FF000003FF00000FFF0000FFFF0000FFFF000028000000100000002000000001000800000000000002000000000000000000000000000000000000000000FFB5B5B5FFB6B6B6FFB9B9B9FFBABABAFFBBBBBBFFBCBCBCFFC2C2C2FFC3C3C3FFC5C5C5FFC6C6C6FFCCCCCCFFCDCDCDFFD1D1D1FFD2D2D2FFD3D3D3FFD4D4D4FFD6D6D6FFD8D8D8FFDFDFDFFFE0E0E0FFE2E2E2FFE4E4E4FFE6E6E6FFE7E7E7FFE8E8E8FFE9E9E9FFEBEBEBFFECECECFFEDEDEDFFEEEEEEFFEFEFEFFFF0F0F0FFF1F1F1FFF2F2F2FFF3F3F3FFF4F4F4FFF5F5F5FFF6F6F6FFF7F7F7FFF8F8F8FFF9F9F9FFFAFAFAFFFBFBFBFFFCFCFCFFFDFDFDFFFEFEFEFFFFFFFFFF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF00" $__bData[1] &= "0000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF2221201B181F2224272A2C2D2D2D2D002E2E2E2E2E2A1D2025292A2B2B2B2B2B2D28211E21282A231A24292A2A2A2B2B28190F0C12171F262A271F252B2C2C2D27170C06050A11161E272C2B252A2C2C27170B040102040910151D272C2C292827170B040101010203080E141C272C2B27170B0401010101010203070D131D2827170B0401010101010203070D131D2827170B040101010203080E141C272C2D27170B040102040910151D272D2D2A2927170C06050A11161F272D2C282A2B2C28190F0C121720282D2C23292B2B2B2C2D28211E21282D2D2726282A2B2B2B2B2F2F2F2E2D271D2226292B2C2C2C2C2B2826211A1A1E23282B2C2D2D2D2D2D00FFFF0000FFFF00000FFF000003FF000000FF0000001F000000070000000100000001000000070000001F000000FF000003FF00000FFF0000FFFF0000FFFF0000" ; arrow_right_enable.ico $__bData[2] &= "0x00000100040008110000010020008C020000460000000811000001000800F4040000D2020000101000000100200068040000C60700001010000001000800680500002E0C0000280000000800000022000000010020000000000040040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FEFEFE09FFFFFF0100000000FFFFFF01FFFFFF01FFFFFF010000000000000000FFFFFFFFFFFFFFFFFFFFFF03FFFFFF01FFFFFF01FFFFFF060000000000000000FFFFFFFF000000FFFFFFFFFFD0D0D00BFFFFFF0100000000FFFFFF0100000000FFFFFFFF000000FF000000FFFFFFFFFFCCCCCC050000000000000000FFFFFF03FFFFFFFF000000FF000000FF000000FFFFFFFFFFFFFFFF0300000000FFFFFF01FFFFFFFF000000FF000000FF000000FF000000FFFFFFFFFFFFFFFF0200000000FFFFFFFF000000FF000000FF000000FF000000FF000000FFFFFFFFFFFFFFFF05FFFFFFFF000000FF000000FF000000FF000000FF000000FF000000FFFFFFFFFFFFFFFFFF000000FF000000FF000000FF000000FF000000FFFFFFFFFFFFFFFF01FFFFFFFF000000FF000000FF000000FF000000FFFFFFFFFFFFFFFF0100000000FFFFFFFF000000FF000000FF000000FFFFFFFFFFFFFFFF0200000000FFFFFF01FFFFFFFF000000FF000000FFFFFFFFFFFFFFFF0300000000FFFFFF01FFFFFF03FFFFFFFF000000FFFFFFFFFF000000000000000000000000FFFFFF0400000000FFFFFFFFFFFFFFFFFFFFFF0200000000FFFFFF01FFFFFF010000000000000000FFFFFF01FFFFFF01FFFFFF03FFFFFF02FFFFFF01FFFFFF010000000000000000FFFFFF010000000000000000FFFFFF01FFFFFF02000000000000000000000000FF000000FF0000003F0000001F0000000F000000070000000300000001000000000000000100000003000000070000000F0000001F0000003F000000FF000000FF00000028000000080000002200000001000800000000001001000000000000000000000000000000000000000000FFD7D7D7FFD9D9D9FFDEDEDEFFE2E2E2FFE4E4E4FFE6E6E6FFE7E7E7FFEAEAEAFFEDEDEDFFF0F0F0FFF1F1F1FFF2F2F2FFF3F3F3FFF5F5F5FFF7F7F7FFF8F8F8FFF9F9F9FFFAFAFAFFFBFBFBFFFDFDFDFFFEFEFEFFFFFFFFFF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF120D0D0F141600000C05070B11141600161601070D12150016001602080E13161600001603090F141600000016040A10160000000016060D160000000000160916000000000000161600000000001609160000000016060D1600000016040A101600001603090F1416001602080E1316161601070D1215000C05070B11141600120D0D0F14160000FF000000FF0000003F0000001F0000000F000000070000000300000001000000000000000100000003000000070000000F0000001F0000003F000000FF000000FF000000280000001000000020" $__bData[2] &= "0000000100200000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F7F7F720FFFFFF1EFEFEFE1BFEFEFE13FFFFFF0600000000FFFFFF01FFFFFF01FFFFFF01FFFFFF01FFFFFF01FFFFFF0100000000000000000000000000000000FFFFFFFFF5F5F5FFE1E1E1FFD9D9D9CAE1E1E160F7F7F720FEFEFE0DFFFFFF02FFFFFF01FFFFFF02FFFFFF04FFFFFF04FFFFFF01000000000000000000000000FFFFFFFFBFBFBFFF3F3F3FFF313131FF959595FFCBCBCBCFDCDCDC70F9F9F931FEFEFE12FFFFFF010000000000000000FFFFFF01FFFFFF01FFFFFF01FFFFFF01FFFFFFFFBFBFBFFF3F3F3FFF000000FF000000FF2D2D2DFF898989FFBDBDBDD2D8D8D878FEFEFE39FEFEFE13FFFFFF0100000000FFFFFF01FFFFFF02FFFFFF02FFFFFFFFBFBFBFFF3F3F3FFF000000FF000000FF000000FF000000FF292929FF7D7D7DFFB0B0B0D6D4D4D483FEFEFE43FEFEFE17FFFFFF01FFFFFF01FFFFFF01FFFFFFFFBFBFBFFF3F3F3FFF000000FF000000FF000000FF000000FF000000FF000000FF252525FF717171FFA3A3A3D9D0D0D08EFEFEFE4FFEFEFE1CFFFFFF02FFFFFFFFBFBFBFFF3F3F3FFF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF212121FF656565FF969696DECDCDCD9BFEFEFE7AFFFFFFFFBFBFBFFF3F3F3FFF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF212121FF656565FF979797DDCDCDCD9AFFFFFF78FFFFFFFFBFBFBFFF3F3F3FFF000000FF000000FF000000FF000000FF000000FF000000FF252525FF717171FFA3A3A3D9D0D0D08EFEFEFE4EFEFEFE1A00000000FFFFFFFFBFBFBFFF3F3F3FFF000000FF000000FF000000FF000000FF292929FF7D7D7DFFAFAFAFD5D3D3D382FEFEFE43FEFEFE1700000000FFFFFF01FFFFFF01FFFFFFFFBFBFBFFF3F3F3FFF000000FF000000FF2D2D2DFF898989FFBDBDBDD2D8D8D877FEFEFE38FEFEFE13FFFFFF01FFFFFF01FFFFFF01FFFFFF02FFFFFF02FFFFFFFFBFBFBFFF3F3F3FFF313131FF959595FFCACACACDDDDDDD6AFEFEFE2AFEFEFE0E0000000000000000FFFFFF01FFFFFF03FFFFFF03FFFFFF01FFFFFF01FFFFFFFFF5F5F5FFE1E1E1FFD9D9D9CAE4E4E45FFEFEFE1FFFFFFF0A00000000FFFFFF01FFFFFF01FFFFFF01FFFFFF01FFFFFF01000000000000000000000000FEFEFE19FEFEFE19FEFEFE19FEFEFE13FFFFFF08FFFFFF03FFFFFF02FFFFFF02FFFFFF01FFFFFF01FFFFFF01FFFFFF0100000000000000000000000000000000FFFFFF01FFFFFF0100000000000000000000000000000000FFFFFF01FFFFFF01FFFFFF02FFFFFF01FFFFFF010000000000000000000000000000000000000000FFFF0000FFFF00000FFF000003FF000000FF0000001F000000070000000100000001000000070000001F000000FF000003FF00000FFF0000FFFF0000FFFF000028000000100000002000000001000800000000000002000000000000000000000000000000000000000000FF010101FF020202FF030303FF040404FF0D0D0DFF0F0F0FFF121212FF151515FF171717FF2E2E2EFF313131FF363636FF3B3B3BFF515151FF525252FF535353FF606060FF646464FF696969FF6B6B6BFF727272FF7A7A7AFF919191FF929292FF949494FF9B9B9BFFA2A2A2FFA8A8A8FFA9A9A9FFAFAFAFFFBEBEBEFFBFBFBFFFC0C0C0FFC3C3C3FFC6C6C6FFC7C7C7FFCBCBCBFFD0D0D0FFE3E3E3FFE5E5E5FFE6E6E6FFE7E7E7FFE8E8E8FFE9E9E9FFEBEBEBFFEDEDEDFFEEEEEEFFEFEFEFFFF0F0F0FFF1F1F1FFF2F2F2FFF3F3F3FFF4F4F4FFF5F5F5FFF6F6F6FFF7F7F7FFF8F8F8FFF9F9F9FFFAFAFAFFFBFBFBFFFCFCFCFFFDFDFDFFFEFEFEFFFFFFFFFF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF00" $__bData[2] &= "0000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF3332312D2A303335383B3D3E3E3E3E003F3F3F3F3F3B2E31363A3B3C3C3C3C3C39292623262C39342C353A3B3B3B3C3C2A1E1310161D252A393730363C3D3D3E281C0F09080D151B242A3A3A363B3D3D281C0E070204070C141A2228393B3939281C0E0701000103060B121920273739281C0E07010000000002050A1118212B281C0E07010000000002050A1117212A281C0E0701000103060B12191F27383A281C0E070204070C141A2228393B3B3A281C0F09080D151B242A3A3B383B3C3D2A1E1310161C252B3C3C343A3C3C3C3D39292623262C3C3E3837393B3C3C3C3C4040403F3D382E33373A3C3D3D3D3D3C3937322C2C2F34393C3D3E3E3E3E3E00FFFF0000FFFF00000FFF000003FF000000FF0000001F000000070000000100000001000000070000001F000000FF000003FF00000FFF0000FFFF0000FFFF0000" Global $__bDatanames[2] = ["arrow_right_disable.ico","arrow_right_enable.ico"] Global $__IcoArrEnable = $__sPath & 'arrow_right_enable.ico' Global $__IcoArrDisable = $__sPath & 'arrow_right_disable.ico' ;=============================================================================== ; Function Name....: _GUICtrlOwnContext_Startup ; Description......: Initialize functions ; Parameter(s).....: $_hGUI GUI Handle ; Return Value(s)..: Nothing ; Author(s)........: BugFix ( bugfix@autoit.de ) ;=============================================================================== Func _GUICtrlOwnContext_Startup($_hGUI) $__hGUI_OWNCONTEXTMNU = $_hGUI ; == initialize Callback Function to analyze $WM_NOTIFY $__hWIN_PROC = DllCallbackRegister('__WinProc', 'ptr', 'hwnd;uint;wparam;lparam') $__hHOOK_PROC = _WinAPI_SetWindowLong($__hGUI_OWNCONTEXTMNU, $GWL_WNDPROC, DllCallbackGetPtr($__hWIN_PROC)) ; == initialize Callback Function to analyze MOUSE-Message $__hSTUB__MouseProc = DllCallbackRegister("__MouseProc", "long", "int;wparam;lparam") $__hMOD = _WinAPI_GetModuleHandle(0) $__hHOOK = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($__hSTUB__MouseProc), $__hMOD) __LoadIcon() EndFunc ;==>_GUICtrlOwnContext_Startup ;=============================================================================== ; Function Name....: _GUICtrlOwnContext_Shutdown ; Description......: Close ressources, automatically on AutoIt exit ; Requirement(s)...: _GUICtrlOwnContext_Startup() must be called before ; Return Value(s)..: Nothing ; Author(s)........: BugFix ( bugfix@autoit.de ) ;=============================================================================== Func _GUICtrlOwnContext_Shutdown() _WinAPI_SetWindowLong($__hGUI_OWNCONTEXTMNU, $GWL_WNDPROC, $__hHOOK_PROC) _WinAPI_UnhookWindowsHookEx($__hHOOK) DllCallbackFree($__hSTUB__MouseProc) For $i = 1 To $__bData[0] FileDelete($__sPath & $__bDatanames[$i -1]) Next EndFunc ;==>_GUICtrlOwnContext_Shutdown ;=============================================================================== ; Function Name....: _GUICtrlOwnContext_Create ; Description......: Creates (Context)Menu ; Parameter(s).....: $_hParentCtrl hWnd or ID of control, for which the menu is to be effective ; .................: $_iWidth Menu width (-1 = 200 px, Default) ; .................: $_iMarginLeft Left margin (-1 = 10 px, Default) ; .................: $_iHoverColor Item hover color, (-1=$__iMNU_DEF_HOVERCOLOR) ; Requirement(s)...: _GUICtrlOwnContext_Startup() must be called before ; Return Value(s)..: Menu Handle ; Author(s)........: BugFix ( bugfix@autoit.de ) ;=============================================================================== Func _GUICtrlOwnContext_Create($_hParentCtrl, $_iWidth=-1, $_iMarginLeft=-1, $_iHoverColor=-1) If Not IsHWnd($_hParentCtrl) Then $_hParentCtrl = GUICtrlGetHandle($_hParentCtrl) If IsKeyword($_iMarginLeft) Or $_iMarginLeft = -1 Then $_iMarginLeft = $__iMNU_DEF_MARGIN If IsKeyword($_iWidth) Or $_iWidth = -1 Then $_iWidth = $__iMNU_DEF_WIDTH Local $hMenu = GUICreate('', $_iWidth, $__iMNU_DEF_HEIGHT, -1, -1, BitOR($WS_BORDER,$WS_POPUP), $WS_EX_MDICHILD, $__hGUI_OWNCONTEXTMNU) If $__aHWND_MNU[UBound($__aHWND_MNU)-1][0] <> '' Then ReDim $__aHWND_MNU[UBound($__aHWND_MNU)+1][8] $__aHWND_MNU[UBound($__aHWND_MNU)-1][0] = $_hParentCtrl $__aHWND_MNU[UBound($__aHWND_MNU)-1][1] = $hMenu $__aHWND_MNU[UBound($__aHWND_MNU)-1][2] = True Local $aItem[2][6] = [[0],[False]] $__aHWND_MNU[UBound($__aHWND_MNU)-1][3] = $aItem $__aHWND_MNU[UBound($__aHWND_MNU)-1][4] = 0 $__aHWND_MNU[UBound($__aHWND_MNU)-1][5] = $_iMarginLeft $__aHWND_MNU[UBound($__aHWND_MNU)-1][6] = $__iMNU_DEF_WIDTH If $_iWidth <> $__iMNU_DEF_WIDTH Then $__aHWND_MNU[UBound($__aHWND_MNU)-1][6] = $_iWidth $__aHWND_MNU[UBound($__aHWND_MNU)-1][7] = $__iMNU_DEF_HOVERCOLOR If $_iHoverColor <> -1 Then $__aHWND_MNU[UBound($__aHWND_MNU)-1][7] = $_iHoverColor Return $hMenu EndFunc ;==>_GUICtrlOwnContext_Create ;=============================================================================== ; Function Name....: _GUICtrlOwnContext_SubCreate ; Description......: Creates a submenu for an item ; Parameter(s).....: $_hParentMnu hWnd of parent menu ; .................: $_iID_ParentItem Item ID from parent menu for which the submenu is to be effective ; .................: $_iWidth Menu width (-1 = 200 px, Default) ; .................: $_iMarginLeft Left margin (-1 = 10 px, Default) ; .................: $_iHoverColor Item hover color, (-1=$__iMNU_DEF_HOVERCOLOR) ; Requirement(s)...: _GUICtrlOwnContext_Startup() must be called before ; Return Value(s)..: Menu Handle ; Author(s)........: BugFix ( bugfix@autoit.de ) ;=============================================================================== Func _GUICtrlOwnContext_SubCreate($_hParentMenu, $_iID_ParentItem, $_iWidth=-1, $_iMarginLeft=-1, $_iHoverColor=-1) If IsKeyword($_iMarginLeft) Or $_iMarginLeft = -1 Then $_iMarginLeft = $__iMNU_DEF_MARGIN If IsKeyword($_iWidth) Or $_iWidth = -1 Then $_iWidth = $__iMNU_DEF_WIDTH Local $iIndexArray = __GetIndexFromMnuArray($_hParentMenu) Local $hSubMenu = GUICreate('', $_iWidth, $__iMNU_DEF_HEIGHT, -1, -1, BitOR($WS_BORDER,$WS_POPUP), $WS_EX_MDICHILD, $_hParentMenu) If $__aHWND_SUBMNU[UBound($__aHWND_SUBMNU)-1][0] <> '' Then ReDim $__aHWND_SUBMNU[UBound($__aHWND_SUBMNU)+1][9] $__aHWND_SUBMNU[UBound($__aHWND_SUBMNU)-1][0] = $_hParentMenu $__aHWND_SUBMNU[UBound($__aHWND_SUBMNU)-1][1] = $hSubMenu $__aHWND_SUBMNU[UBound($__aHWND_SUBMNU)-1][2] = True Local $aItem[2][6] = [[0],[False]] $__aHWND_SUBMNU[UBound($__aHWND_SUBMNU)-1][3] = $aItem $__aHWND_SUBMNU[UBound($__aHWND_SUBMNU)-1][4] = 0 $__aHWND_SUBMNU[UBound($__aHWND_SUBMNU)-1][5] = $_iMarginLeft $__aHWND_SUBMNU[UBound($__aHWND_SUBMNU)-1][6] = $__iMNU_DEF_WIDTH If $_iWidth <> $__iMNU_DEF_WIDTH Then $__aHWND_SUBMNU[UBound($__aHWND_SUBMNU)-1][6] = $_iWidth $__aHWND_SUBMNU[UBound($__aHWND_SUBMNU)-1][7] = $__iMNU_DEF_HOVERCOLOR If $_iHoverColor <> -1 Then $__aHWND_SUBMNU[UBound($__aHWND_SUBMNU)-1][7] = $_iHoverColor $__aHWND_SUBMNU[UBound($__aHWND_SUBMNU)-1][8] = $_iID_ParentItem __RegisterSubMenu($iIndexArray, $_iID_ParentItem, $hSubMenu) ; registriert das Parent-Item zur Anzeige eines SubMenüs Return $hSubMenu EndFunc ;==>_GUICtrlOwnContext_SubCreate ;=============================================================================== ; Function Name....: _GUICtrlOwnContext_AddItem ; Description......: Creates Menu-Item (Default-Item, Checkbox-Item, Radio-Item, Shape) ; Parameter(s).....: $_hMnu Menu Handle ; .................: $_sText Item-Text, if empty string (Default) ==> create shape ; .................: $_iType 1=Label (Default), 2=Checkbox, 3=Radio ; .................: $_iMarginLeft Left margin, only if different from value, that used with _GUICtrlOwnContext_Create ; Requirement(s)...: with _GUICtrlOwnContext_Create menu created ; Return Value(s)..: Success Item-ID ; .................: Failure -1, @error=1 on specified handle does not exist ; Author(s)........: BugFix ( bugfix@autoit.de ) ;=============================================================================== Func _GUICtrlOwnContext_AddItem($_hMnu, $_sText='', $_iType=1, $_iMarginLeft=-1) Local $fSub = __IsSub($_hMnu), $iIndexArray = __GetIndexFromMnuArray($_hMnu) If @error Then Return SetError(1,0,-1) Local $aItem, $iCountShape, $iCountEntry, $iWidth, $iHeight, $iID, $iTop_BackLabel, $iIDArrow If $fSub Then $aItem = $__aHWND_SUBMNU[$iIndexArray][3] $iCountShape = $__aHWND_SUBMNU[$iIndexArray][4] $iCountEntry = $aItem[0][0] -$iCountShape If IsKeyword($_iMarginLeft) Or $_iMarginLeft = -1 Then $_iMarginLeft = $__aHWND_SUBMNU[$iIndexArray][5] $iWidth = $__aHWND_SUBMNU[$iIndexArray][6] Else $aItem = $__aHWND_MNU[$iIndexArray][3] $iCountShape = $__aHWND_MNU[$iIndexArray][4] $iCountEntry = $aItem[0][0] -$iCountShape If IsKeyword($_iMarginLeft) Or $_iMarginLeft = -1 Then $_iMarginLeft = $__aHWND_MNU[$iIndexArray][5] $iWidth = $__aHWND_MNU[$iIndexArray][6] EndIf $iHeight = $__iMNU_DEF_HEIGHT If $_sText = '' Then $_iType = 4 If $_iType = 4 Then $iHeight = $__iMNU_DEF_SHAPEHEIGHT $iTop_BackLabel = ($iCountEntry*$__iMNU_DEF_HEIGHT + $iCountShape*$__iMNU_DEF_SHAPEHEIGHT) GUICtrlCreateLabel('', 0, $iTop_BackLabel, $iWidth, $iHeight) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetState(-1, $GUI_DISABLE) If $_iType = 4 Then $iCountShape += 1 If Not $fSub Then $iIDArrow = GUICtrlCreateIcon($__IcoArrEnable, -1, $iWidth-13, ($__iMNU_DEF_LABELSHIFT+ $iCountEntry*$__iMNU_DEF_HEIGHT + $iCountShape*$__iMNU_DEF_SHAPEHEIGHT), 8, 17) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetResizing(-1, $GUI_DOCKALL) EndIf ReDim $aItem[UBound($aItem)+1][6] $aItem[0][0] += 1 WinMove($_hMnu, '', 10, 10, $iWidth, ($aItem[0][0]-$iCountShape)*$__iMNU_DEF_HEIGHT + $iCountShape*$__iMNU_DEF_SHAPEHEIGHT) Local $iItemTop = ($__iMNU_DEF_LABELSHIFT+ $iCountEntry*$__iMNU_DEF_HEIGHT + $iCountShape*$__iMNU_DEF_SHAPEHEIGHT) Switch $_iType Case 1 ; Default Label $iID = GUICtrlCreateLabel($_sText, $_iMarginLeft, $iItemTop, $iWidth-$_iMarginLeft-17, 17) Case 2 ; Checkbox $iID = GUICtrlCreateCheckbox($_sText, $_iMarginLeft, $iItemTop-1, $iWidth-$_iMarginLeft-17, 17) Case 3 ; Radio $iID = GUICtrlCreateRadio($_sText, $_iMarginLeft, $iItemTop-1, $iWidth-$_iMarginLeft-17, 17) $aItem[1][0] = True Case 4 ; Shape $iID = GUICtrlCreateLabel('', 4, ($iCountEntry*$__iMNU_DEF_HEIGHT + ($iCountShape-1)*$__iMNU_DEF_SHAPEHEIGHT), $iWidth-8, 1, $SS_GRAYFRAME) EndSwitch GUICtrlSetResizing($iID, $GUI_DOCKALL) $aItem[$aItem[0][0]+1][0] = $iID $aItem[$aItem[0][0]+1][1] = $_iType If $fSub Then $aItem[$aItem[0][0]+1][2] = -1 Else $aItem[$aItem[0][0]+1][2] = $iIDArrow EndIf $aItem[$aItem[0][0]+1][4] = $iTop_BackLabel $aItem[$aItem[0][0]+1][5] = DllStructCreate($tagRECT) If $fSub Then $__aHWND_SUBMNU[$iIndexArray][3] = $aItem $__aHWND_SUBMNU[$iIndexArray][4] = $iCountShape Else $__aHWND_MNU[$iIndexArray][3] = $aItem $__aHWND_MNU[$iIndexArray][4] = $iCountShape EndIf Return $iID EndFunc ;==>_GUICtrlOwnContext_AddItem ;=============================================================================== ; Function Name....: _GUICtrlOwnContext_AddImage ; Description......: Creates Menu-Item with Image (icon, jpg/gif/bmp, colored squares) ; Parameter(s).....: $_hMnu Menu Handle ; .................: $_sText Item-Text ; .................: $_sPathImage Path image file ; .................: $_sIconName Name or number of icon inside icon file with multiple icons, -1 (Default) ; .................: $_iType 1=Picture(bmp,jpg,gif), 2=Icon, 3=colored squares ; .................: $_iMarginLeft Left margin, only if different from value, that used with _GUICtrlOwnContext_Create ; .................: $_iColor Color for squares ; Requirement(s)...: with _GUICtrlOwnContext_Create menu created ; Return Value(s)..: Success Item-ID ; .................: Failure -1, @error=1 on specified handle does not exist ; Author(s)........: BugFix ( bugfix@autoit.de ) ;=============================================================================== Func _GUICtrlOwnContext_AddImage($_hMnu, $_sText, $_sPathImage='', $_sIconName=-1, $_iType=1, $_iMarginLeft=-1, $_iColor=0xFFFFFF) Local $fSub = __IsSub($_hMnu), $iIndexArray = __GetIndexFromMnuArray($_hMnu) If @error Then Return SetError(1,0,-1) Local $aItem, $iCountShape, $iCountEntry, $iWidth, $iID, $iTop_BackLabel, $iIDArrow If $fSub Then $aItem = $__aHWND_SUBMNU[$iIndexArray][3] $iCountShape = $__aHWND_SUBMNU[$iIndexArray][4] $iCountEntry = $aItem[0][0] -$iCountShape If IsKeyword($_iMarginLeft) Or $_iMarginLeft = -1 Then $_iMarginLeft = $__aHWND_SUBMNU[$iIndexArray][5] $iWidth = $__aHWND_SUBMNU[$iIndexArray][6] Else $aItem = $__aHWND_MNU[$iIndexArray][3] $iCountShape = $__aHWND_MNU[$iIndexArray][4] $iCountEntry = $aItem[0][0] -$iCountShape If IsKeyword($_iMarginLeft) Or $_iMarginLeft = -1 Then $_iMarginLeft = $__aHWND_MNU[$iIndexArray][5] $iWidth = $__aHWND_MNU[$iIndexArray][6] EndIf $iTop_BackLabel = ($iCountEntry*$__iMNU_DEF_HEIGHT + $iCountShape*$__iMNU_DEF_SHAPEHEIGHT) GUICtrlCreateLabel('', 0, $iTop_BackLabel, $iWidth, $__iMNU_DEF_HEIGHT) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetState(-1, $GUI_DISABLE) If Not $fSub Then $iIDArrow = GUICtrlCreateIcon($__IcoArrEnable, -1, $iWidth-13, ($__iMNU_DEF_LABELSHIFT+ $iCountEntry*$__iMNU_DEF_HEIGHT + $iCountShape*$__iMNU_DEF_SHAPEHEIGHT), 8, 17) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetResizing(-1, $GUI_DOCKALL) EndIf ReDim $aItem[UBound($aItem)+1][6] $aItem[0][0] += 1 WinMove($_hMnu, '', 10, 10, $iWidth, ($aItem[0][0]-$iCountShape)*$__iMNU_DEF_HEIGHT + $iCountShape*$__iMNU_DEF_SHAPEHEIGHT) Local $iItemTop = ($__iMNU_DEF_LABELSHIFT+ $iCountEntry*$__iMNU_DEF_HEIGHT + $iCountShape*$__iMNU_DEF_SHAPEHEIGHT), $iIDPic If $_iMarginLeft < 2 Then $_iMarginLeft = 2 Switch $_iType Case 1 Local $iStyle = $SS_NOTIFY If StringRight($_sPathImage, 3) = 'bmp' Then $iStyle = BitOR($iStyle,$SS_BITMAP) $iIDPic = GUICtrlCreatePic($_sPathImage, $_iMarginLeft -2, $iItemTop-1, 16, 16, $iStyle) $iID = GUICtrlCreateLabel($_sText, $_iMarginLeft +16 , $iItemTop, $iWidth-$_iMarginLeft-33, 17) Case 2 $iIDPic = GUICtrlCreateIcon($_sPathImage, $_sIconName, $_iMarginLeft -2, $iItemTop-1, 16, 16, BitOR($SS_NOTIFY,$SS_ICON)) $iID = GUICtrlCreateLabel($_sText, $_iMarginLeft +16 , $iItemTop, $iWidth-$_iMarginLeft-33, 17) Case 3 $iIDPic = GUICtrlCreateLabel('', $_iMarginLeft -2, $iItemTop-1, 16, 16) GUICtrlSetBkColor(-1, $_iColor) $iID = GUICtrlCreateLabel($_sText, $_iMarginLeft +16 , $iItemTop, $iWidth-$_iMarginLeft-33, 17) EndSwitch GUICtrlSetResizing($iIDPic, $GUI_DOCKALL) GUICtrlSetResizing($iID, $GUI_DOCKALL) $aItem[$aItem[0][0]+1][0] = $iID $aItem[$aItem[0][0]+1][1] = 1 If $fSub Then $aItem[$aItem[0][0]+1][2] = -1 Else $aItem[$aItem[0][0]+1][2] = $iIDArrow EndIf $aItem[$aItem[0][0]+1][4] = $iTop_BackLabel $aItem[$aItem[0][0]+1][5] = DllStructCreate($tagRECT) If $fSub Then $__aHWND_SUBMNU[$iIndexArray][3] = $aItem Else $__aHWND_MNU[$iIndexArray][3] = $aItem EndIf Return $iID EndFunc ;==>_GUICtrlOwnContext_AddImage ;=============================================================================== ; Function Name....: _GUICtrlOwnContext_ShowFlag ; Description......: Condition to show Menu (True/False) ; .................: If the condition is TRUE, the menu will displayed. ; Parameter(s).....: $_hMnu Menu Handle ; .................: $_fFlag Boolean expression (eg a test function to return True / False) ; Requirement(s)...: with _GUICtrlOwnContext_Create menu created ; Return Value(s)..: Nothing ; Author(s)........: BugFix ( bugfix@autoit.de ) ;=============================================================================== Func _GUICtrlOwnContext_ShowFlag($_hMnu, $_fFlag=False) For $i = 0 To UBound($__aHWND_MNU) -1 If $__aHWND_MNU[$i][1] = $_hMnu Then $__aHWND_MNU[$i][2] = $_fFlag Return EndIf Next EndFunc ;==>_GUICtrlOwnContext_ShowFlag ;=============================================================================== ; Function Name....: _GUICtrlOwnContext_SetHoverColor ; Description......: Sets custom hover color ; Parameter(s).....: $_hMnu Menu Handle ; .................: $_iColor custom RGB color ; Requirement(s)...: with _GUICtrlOwnContext_Create menu created ; Return Value(s)..: ; Author(s)........: BugFix ( bugfix@autoit.de ) ;=============================================================================== Func _GUICtrlOwnContext_SetHoverColor($_hMnu, $_iColor=$__iMNU_DEF_HOVERCOLOR) Local $iIndexArray = __GetIndexFromMnuArray($_hMnu) If @error Then Return SetError(1,0,$iIndexArray) $__aHWND_MNU[$iIndexArray][7] = $_iColor Return '0x' & Hex($_iColor,6) EndFunc ;==>_GUICtrlOwnContext_SetHoverColor #region - internal functions ;=============================================================================== ; Function Name....: __LoadIcon ; Description......: Creates temporary icon files for submenu arrow ;=============================================================================== Func __LoadIcon() For $i = 1 To $__bData[0] Local $sFile = $__sPath & $__bDatanames[$i -1] Local $hFileOut = FileOpen($sFile, 2+8+16) FileWrite($hFileOut, Binary($__bData[$i])) FileClose($hFileOut) Next EndFunc ;==>__LoadIcon ;=============================================================================== ; Function Name....: __GetIndexFromMnuArray ; Description......: Search index from menu array for given menu handle ;=============================================================================== Func __GetIndexFromMnuArray($_hMnu) If __IsSub($_hMnu) Then For $i = 0 To UBound($__aHWND_SUBMNU) -1 If $__aHWND_SUBMNU[$i][1] = $_hMnu Then Return $i EndIf Next Else For $i = 0 To UBound($__aHWND_MNU) -1 If $__aHWND_MNU[$i][1] = $_hMnu Then Return $i EndIf Next EndIf Return SetError(1,0,-1) EndFunc ;==>__GetIndexFromMnuArray Func __RegisterSubMenu($_iIndexMnuArray, $_iID, $_hSubMenu) Local $aItem = $__aHWND_MNU[$_iIndexMnuArray][3] For $i = 2 To $aItem[0][0] +1 If $aItem[$i][0] = $_iID Then $aItem[$i][3] = $_hSubMenu ; Handle des SubMenü $__aHWND_MNU[$_iIndexMnuArray][3] = $aItem ExitLoop EndIf Next EndFunc ;=============================================================================== ; Function Name....: __WinProc ; Description......: Callback windows procedure ;=============================================================================== Func __WinProc($hWnd, $Msg, $wParam, $lParam) Switch $Msg Case $WM_NOTIFY Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $iOldOpt, $aMPos $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") $iOldOpt = Opt('MouseCoordMode', 1) $aMPos = MouseGetPos() Opt('MouseCoordMode', $iOldOpt) ; == Menu is shown, clicked outside menu, but inside assigned control ==> Menu hide If $__hCURRENT_ACTIVE_MNU <> 0 And $iCode = $NM_CLICK Then Local $tPoint = DllStructCreate('int;int') DllStructSetData($tPoint, 1, $aMPos[0]) DllStructSetData($tPoint, 2, $aMPos[1]) Local $tRectContext = _WinAPI_GetWindowRect($__hCURRENT_ACTIVE_MNU), $iDummy = 0 If Not _WinAPI_PtInRect($tRectContext, $tPoint) Then __MenuHide($iDummy) Return _WinAPI_CallWindowProc($__hHOOK_PROC, $hWnd, $Msg, $wParam, $lParam) EndIf EndIf ; == Menu show Switch $iCode Case $NM_RCLICK For $i = 0 To UBound($__aHWND_MNU) -1 If $hWndFrom = $__aHWND_MNU[$i][0] Then If $__aHWND_MNU[$i][2] Then ; == Condition True? $__hCURRENT_ACTIVE_MNU = $__aHWND_MNU[$i][1] Local $aWin = WinGetPos($__hGUI_OWNCONTEXTMNU) Local $aWinMnu = WinGetPos($__hCURRENT_ACTIVE_MNU) Local $iX = $aMPos[0], $iY = $aMPos[1] If $iX +$aWinMnu[2] > @DesktopWidth Then $iX -= $aWinMnu[2] If $iY +$aWinMnu[3] > @DesktopHeight Then $iY = @DesktopHeight -$aWinMnu[3] -10 WinMove($__hCURRENT_ACTIVE_MNU, '', $iX, $iY) __MenuShow($i) EndIf ExitLoop EndIf Next EndSwitch Case Else Return _WinAPI_CallWindowProc($__hHOOK_PROC, $hWnd, $Msg, $wParam, $lParam) EndSwitch EndFunc ;==>__WinProc ;=============================================================================== ; Function Name....: __MouseProc ; Description......: Callback mouse procedure ;=============================================================================== Func __MouseProc($nCode, $wParam, $lParam) If $nCode <> $__HC_ACTION Or ($__hCURRENT_ACTIVE_MNU = 0 And $__hCURRENT_ACTIVE_SUB = 0) Then Return _WinAPI_CallNextHookEx($__hHOOK, $nCode, $wParam, $lParam) ; ==> default processing Local Static $iID_LastOver = 0, $iID_LastOverSub = 0 Local Static $iX, $iY Local $iType, $aItem, $iIndexArray, $iIndexItem, $aInfo, $iCtrl, $iType Local $tMSLLHOOKSTRUCT = DllStructCreate("int X;int Y;dword mouseData;dword flags;dword time;ulong_ptr dwExtraInfo", $lParam) Local $tPoint = DllStructCreate('int;int') $iX = DllStructGetData($tMSLLHOOKSTRUCT, 1) $iY = DllStructGetData($tMSLLHOOKSTRUCT, 2) DllStructSetData($tPoint, 1, $iX) DllStructSetData($tPoint, 2, $iY) Local $fMnu = __MousOnMenu($tPoint) Switch $wParam Case $WM_MOUSEMOVE ; if mouse is hover Local $iHoverColor, $iWidth, $iState, $aWin, $xSub, $ySub, $aSub, $wSub, $hSub If $fMnu Then ; mouse over menu $aInfo = __GetCtrl_Type($fMnu, $tPoint) ; info menu $iCtrl = $aInfo[0] $iType = $aInfo[1] $iIndexArray = $aInfo[2] $iIndexItem = $aInfo[3] $aItem = $__aHWND_MNU[$iIndexArray][3] If $iCtrl <> $iID_LastOver Then $iHoverColor = $__aHWND_MNU[$iIndexArray][7] $iWidth = $__aHWND_MNU[$iIndexArray][6] $iState = BitAND(GUICtrlGetState($iCtrl), $GUI_ENABLE) ; state enable If IsHWnd($__hCURRENT_ACTIVE_SUB) And $aItem[$iIndexItem][3] <> $__hCURRENT_ACTIVE_SUB Then GUISetState(@SW_HIDE, $__hCURRENT_ACTIVE_SUB) $__hCURRENT_ACTIVE_SUB = 0 EndIf GUICtrlSetBkColor($iID_LastOver, $GUI_BKCOLOR_TRANSPARENT) If ControlGetText($__hCURRENT_ACTIVE_MNU, '', $iCtrl) <> '' And $iState Then $iID_LastOver = $iCtrl GUICtrlSetBkColor($iCtrl, $iHoverColor) EndIf If IsHWnd($aItem[$iIndexItem][3]) And $iState And Not BitAND(WinGetState($aItem[$iIndexItem][3]), $GUI_SHOW) And $__hCURRENT_ACTIVE_SUB <> $aItem[$iIndexItem][3] Then ; with submenu AND enable AND (submenu NOT displayed) $__hCURRENT_ACTIVE_SUB = $aItem[$iIndexItem][3] $aWin = WinGetPos($__hCURRENT_ACTIVE_MNU) $xSub = $aWin[0] +$iWidth -5 $ySub = $aWin[1] +$aItem[$iIndexItem][4] +5 $aSub = WinGetPos($aItem[$iIndexItem][3]) $wSub = $aSub[2] $hSub = $aSub[3] If $xSub +$wSub > @DesktopWidth Then $xSub = $aWin[0] -$wSub +5 If $ySub +$hSub > @DesktopHeight Then $ySub = @DesktopHeight -$hSub -10 WinMove($aItem[$iIndexItem][3], '', $xSub, $ySub) $__hCURRENT_ACTIVE_SUB = $aItem[$iIndexItem][3] __MenuShowSub() EndIf EndIf Else ; mouse over submenu Local $tRectSub = _WinAPI_GetWindowRect($__hCURRENT_ACTIVE_SUB), $fSub = False If _WinAPI_PtInRect($tRectSub, $tPoint) Then $aInfo = __GetCtrl_Type(False, $tPoint) $iCtrl = $aInfo[0] $iType = $aInfo[1] $iIndexArray = $aInfo[2] $iIndexItem = $aInfo[3] If $iCtrl <> $iID_LastOverSub Then $iHoverColor = $__aHWND_SUBMNU[$iIndexArray][7] $iWidth = $__aHWND_SUBMNU[$iIndexArray][6] $iState = BitAND(GUICtrlGetState($iCtrl), $GUI_ENABLE) GUICtrlSetBkColor($iID_LastOverSub, $GUI_BKCOLOR_TRANSPARENT) If ControlGetText($__hCURRENT_ACTIVE_SUB, '', $iCtrl) <> '' And $iState Then $iID_LastOverSub = $iCtrl GUICtrlSetBkColor($iCtrl, $iHoverColor) EndIf EndIf Else Return _WinAPI_CallNextHookEx($__hHOOK, $nCode, $wParam, $lParam) ; ==> default processing EndIf EndIf Case $WM_RBUTTONDOWN If Not __MousOnMenu($tPoint) And Not __MousOnSubMenu($tPoint) Then __MenuHideSub(True, $iID_LastOver, $iID_LastOverSub) Return _WinAPI_CallNextHookEx($__hHOOK, $nCode, $wParam, $lParam) ; ==> default processing Case $WM_LBUTTONDOWN If Not __MousOnMenu($tPoint) And Not __MousOnSubMenu($tPoint) Then __MenuHideSub(True, $iID_LastOver, $iID_LastOverSub) Return _WinAPI_CallNextHookEx($__hHOOK, $nCode, $wParam, $lParam) ; ==> default processing Else $iCtrl = 0 If __MousOnMenu($tPoint) Then $aInfo = __GetCtrl_Type(True, $tPoint) $iCtrl = $aInfo[0] $iType = $aInfo[1] $iIndexArray = $aInfo[2] $iIndexItem = $aInfo[3] $aItem = $__aHWND_MNU[$iIndexArray][3] ElseIf __MousOnSubMenu($tPoint) Then $aInfo = __GetCtrl_Type(False, $tPoint) $iCtrl = $aInfo[0] $iType = $aInfo[1] $iIndexArray = $aInfo[2] $iIndexItem = $aInfo[3] $aItem = $__aHWND_SUBMNU[$iIndexArray][3] EndIf If $iCtrl <> 0 Then ; ctrl is disabled OR has submenu ==> do nothing If BitAND(GUICtrlGetState($iCtrl), $GUI_DISABLE) Or IsHWnd($aItem[$iIndexItem][3]) Then Return -1 ; set state for checkbox/radios If $iType = 2 Then GUICtrlSetState($iCtrl, BitXOR(BitOR($GUI_CHECKED, $GUI_UNCHECKED), BitAND(GUICtrlRead($iCtrl),$GUI_CHECKED))) ElseIf $iType = 3 Then GUICtrlSetState($iCtrl, BitXOR(BitOR($GUI_CHECKED, $GUI_UNCHECKED), BitAND(GUICtrlRead($iCtrl),$GUI_CHECKED))) For $i = 2 To $aItem[0][0] +1 If $aItem[$i][1] <> 3 Or $aItem[$i][0] = $iCtrl Then ContinueLoop GUICtrlSetState($aItem[$i][0], $GUI_UNCHECKED) Next EndIf _SendMessage($__hCURRENT_ACTIVE_MNU, $WM_COMMAND, $iCtrl, 0) ; sends the message to the window procedure __MenuHideSub(True, $iID_LastOver, $iID_LastOverSub) Return -1 ; ==> no default processing EndIf EndIf EndSwitch Return _WinAPI_CallNextHookEx($__hHOOK, $nCode, $wParam, $lParam) ; ==> default processing EndFunc ;==>__MouseProc ;=============================================================================== ; Function Name....: __GetCtrl_Type ; Description......: Get Ctrl-ID, Type, MenuArrayIndex, ItemArrayIndex from menu or submenu ;=============================================================================== Func __GetCtrl_Type($_fMnu, $_tPoint) If $_fMnu Then For $i = 0 To UBound($__aHWND_MNU) -1 If $__aHWND_MNU[$i][1] = $__hCURRENT_ACTIVE_MNU Then $aItem = $__aHWND_MNU[$i][3] For $j = 2 To $aItem[0][0] +1 If _WinAPI_PtInRect($aItem[$j][5], $_tPoint) Then Local $aRet[4] = [$aItem[$j][0],$aItem[$j][1], $i, $j] Return $aRet EndIf Next EndIf Next Else For $i = 0 To UBound($__aHWND_SUBMNU) -1 If $__aHWND_SUBMNU[$i][1] = $__hCURRENT_ACTIVE_SUB Then $aItem = $__aHWND_SUBMNU[$i][3] For $j = 2 To $aItem[0][0] +1 If _WinAPI_PtInRect($aItem[$j][5], $_tPoint) Then Local $aRet[4] = [$aItem[$j][0],$aItem[$j][1], $i, $j] Return $aRet EndIf Next EndIf Next EndIf Return SetError(1,0,0) EndFunc ;==>__GetCtrl_Type ;=============================================================================== ; Function Name....: __MousOnMenu ; Description......: Detects, if mouse is inside menu area ;=============================================================================== Func __MousOnMenu($_tPoint) Local $tRect = _WinAPI_GetWindowRect($__hCURRENT_ACTIVE_MNU) Return _WinAPI_PtInRect($tRect, $_tPoint) EndFunc ;==>__MousOnMenu ;=============================================================================== ; Function Name....: __MousOnSubMenu ; Description......: Detects, if mouse is inside submenu area ;=============================================================================== Func __MousOnSubMenu($_tPoint) Local $tRect = _WinAPI_GetWindowRect($__hCURRENT_ACTIVE_SUB) Return _WinAPI_PtInRect($tRect, $_tPoint) EndFunc ;==>__MousOnSubMenu ;=============================================================================== ; Function Name....: __MenuShow ; Description......: Displays the menu and sets the image of the submenu-arrow (related to its status), if an submenu exists ; .................: Store current absolute item position to RECT ;=============================================================================== Func __MenuShow($_iIndexMnuArray) Local $aWin = WinGetPos($__hCURRENT_ACTIVE_MNU) ; absolute menu position Local $aItem = $__aHWND_MNU[$_iIndexMnuArray][3] Local $iHeight For $i = 2 To $aItem[0][0] +1 $iHeight = $__iMNU_DEF_HEIGHT If ControlGetText($__hCURRENT_ACTIVE_MNU, '', $aItem[$i][0]) = '' Then $iHeight = $__iMNU_DEF_SHAPEHEIGHT ; Item-RECT , abs. X , abs. Y + rel. item Y , abs. X + width , abs. Y + rel. item Y + item/shape height _WinAPI_SetRect($aItem[$i][5], $aWin[0], $aWin[1]+$aItem[$i][4], $aWin[0]+$aWin[2], $aWin[1]+$aItem[$i][4]+$iHeight) If IsHWnd($aItem[$i][3]) Then ; has submenu If BitAND(GUICtrlGetState($aItem[$i][0]), $GUI_DISABLE) Then GUICtrlSetImage($aItem[$i][2], $__IcoArrDisable) GUICtrlSetState($aItem[$i][2], BitOR($GUI_DISABLE, $GUI_SHOW)) Else GUICtrlSetImage($aItem[$i][2], $__IcoArrEnable) GUICtrlSetState($aItem[$i][2], BitOR($GUI_ENABLE, $GUI_SHOW)) EndIf EndIf Next GUISetState(@SW_SHOW, $__hCURRENT_ACTIVE_MNU) EndFunc ;==>__MenuShow ;=============================================================================== ; Function Name....: __MenuShowSub ; Description......: Displays the submenu ; .................: Store current absolute item position to RECT ;=============================================================================== Func __MenuShowSub() Local $_iIndexMnuArray = __GetIndexFromMnuArray($__hCURRENT_ACTIVE_SUB) Local $aWin = WinGetPos($__hCURRENT_ACTIVE_SUB) ; absolute menu position Local $aItem = $__aHWND_SUBMNU[$_iIndexMnuArray][3] Local $iHeight For $i = 2 To $aItem[0][0] +1 $iHeight = $__iMNU_DEF_HEIGHT If ControlGetText($__hCURRENT_ACTIVE_SUB, '', $aItem[$i][0]) = '' Then $iHeight = $__iMNU_DEF_SHAPEHEIGHT ; Item-RECT , abs. X , abs. Y + rel. item Y , abs. X + width , abs. Y + rel. item Y + item/shape height _WinAPI_SetRect($aItem[$i][5], $aWin[0], $aWin[1]+$aItem[$i][4], $aWin[0]+$aWin[2], $aWin[1]+$aItem[$i][4]+$iHeight) Next GUISetState(@SW_SHOW, $__hCURRENT_ACTIVE_SUB) EndFunc ;==>__MenuShow ;=============================================================================== ; Function Name: _WinAPI_SetRect(ByRef $tRECT, $X1, $Y1, $X2, $Y2) ; Description: Fills an RECT-Structure with all values at once ; Parameter(s): $tRECT RECT-Structure ; $X1, $Y1, $X2, $Y2 Values of Rectangle ; Return Value(s): Success <> 0 ; Failure 0 set @error 1-no Structure given ; Author(s): BugFix (bugfix@autoit.de) ;=============================================================================== Func _WinAPI_SetRect(ByRef $tRECT, $X1, $Y1, $X2, $Y2) If Not IsDllStruct($tRECT) Then Return SetError(1,0,0) Local $ret = DllCall("user32", 'long', 'SetRect', 'ptr', DllStructGetPtr($tRECT), 'long', $X1, 'long', $Y1, 'long', $X2, 'long', $Y2) If @error > 0 Then Return SetError(1,@error,0) Return $ret[0] EndFunc ;==>_WinAPI_SetRect ;=============================================================================== ; Function Name....: __MenuHide ; Description......: Hides menu ;=============================================================================== Func __MenuHide(ByRef $_iID_LastOver) GUISetState(@SW_HIDE, $__hCURRENT_ACTIVE_MNU) GUISetState(@SW_SHOW, $__hGUI_OWNCONTEXTMNU) If $_iID_LastOver > 0 Then GUICtrlSetBkColor($_iID_LastOver, $GUI_BKCOLOR_TRANSPARENT) $_iID_LastOver = 0 EndIf $__hCURRENT_ACTIVE_MNU = 0 EndFunc ;==>__MenuHide ;=============================================================================== ; Function Name....: __MenuHideSub ; Description......: Hides submenu (and optional menu) ;=============================================================================== Func __MenuHideSub($_fShowMain, ByRef $_iID_LastOver, ByRef $_iID_LastOverSub) GUISetState(@SW_HIDE, $__hCURRENT_ACTIVE_SUB) If $_iID_LastOverSub > 0 Then GUICtrlSetBkColor($_iID_LastOverSub, $GUI_BKCOLOR_TRANSPARENT) $_iID_LastOverSub = 0 EndIf $__hCURRENT_ACTIVE_SUB = 0 If $_fShowMain Then __MenuHide($_iID_LastOver) EndFunc ;==>__MenuHideSub ;=============================================================================== ; Function Name....: __MouseOverCtrl ; Description......: Checks if mouse is over an given control ;=============================================================================== Func __MouseOverCtrl($_hGUI, $_iID, $_aMPos) Local $posC = ControlGetPos($_hGUI, '', $_iID) If @error Then Return False If ($_aMPos[0] >= $posC[0] And $_aMPos[0] <= $posC[0]+$posC[2]) And _ ($_aMPos[1] >= $posC[1] And $_aMPos[1] <= $posC[1]+$posC[3]) Then Return True Else Return False EndIf EndFunc ;==>__MouseOverCtrl ;=============================================================================== ; Function Name....: __IsSub ; Description......: Determines if menu is an submenu ;=============================================================================== Func __IsSub($_hWnd) Local $hParent = _WinAPI_GetParent($_hWnd) ; if $_hWnd is submenu ==> gets menu handle If $hParent = $__hGUI_OWNCONTEXTMNU Then Return False $hParent = _WinAPI_GetParent($hParent) ; if $_hWnd is submenu ==> gets Main-GUI handle If $hParent = $__hGUI_OWNCONTEXTMNU Then Return True Return False EndFunc ;==>__IsSub #endregion