Jump to content

Recommended Posts

Posted (edited)

There is only one reason to open new thread. If Holger against adding the change in ModernMenuRaw and release them under the name ModernMenuRaw. Everything else is heresy

Edited by nickston
Posted

hello, few questions i have for anyone who has been using this great UDF:

1) is there a way to have the menu with the side title, but without icons (and without the icons placeholder)?

not setting icons at all does not do it - it reverts the modern menu back to standard.

2) is there a way to have a submenu without icons (and without the icons placeholder), but keep the modern menu colors?

3) is there a way to make the tray menu respond to double-click?

thanks for any hints.

3) If you ask about tray icon, then it's been working.

_TrayIconSetClick(TrayIconID, Clicks)

Posted

nickston, I have tested the first example in post 298. It's not working. I have tested on 3.3.10, Win 7 32/64 bit, XP 32 bit. No tray icon at all. No errors in Scite. Are you sure that the single update in post 293 is enough to make flashing work? Which UDF are you using when you run the example?

In the old posts there are some issues about the flashing. But there are no examples.

I would like to see a working example before I update the UDF.

Posted (edited)

LarsJ, yes it is. that's enough.

1) start example, in the tray we will see icon

2) click on icon, in rise menu click "start"

3) And we will see icon in the tray will flashing

4) do 2)

5) Flashing stop

there may be in example has included old MMR , unmodified.

Edited by nickston
Posted

Also, i have some revision of MMR, in which for differnt mouse clicks the Trayicon shows a different menus. It contains all the improvements listed above.

Posted

I had to add an extra point to your list:

0) Edit example and add "_TrayIconSetState()" before the message loop

But it's a nice example. Shows how to start/stop flashing. The flashing works fine.

I have tested flashing with one of the examples by AZJIO. Works fine here too.

You are right. It's enough to edit this single line in the UDF to make flashing work.

I'll update the UDF in the weekend and add your example to the zip, if you don't mind.

Posted

I have not read the code.

It's not my intention to add a lot of new code to the UDF.

It's my intention to update the UDF to make it run under the current versions of AutoIt, and to get rid of errors. Especially already known errors, which can be fixed in a few lines of code.

Posted

OK. Fine. Please explain in each single case in a line or two, what's the problem with the existing code, and what's your solution. It wasn't my intention either, to spend too much time on these updates.

I'll hold back the update for a week. Then we can figure out if more updates should be included.

Posted (edited)

just in case:

1.Look at Func _GetIconID($nID, $sFile)

If StringRight($sFile, 4) = ".exe" Then
        If $nID < 0 Then
            $nID = - ($nID + 1)
        ElseIf $nID > 0 Then
            $nID = - $nID
        EndIf
    ElseIf StringRight($sFile, 4) = ".icl" And $nID < 0 Then
        $nID = - ($nID + 1)
    Else
        If $nID > 0 Then
            $nID = - $nID
        ElseIf $nID < 0 Then
            $nID = - ($nID + 1)
        EndIf
    EndIf

Its fully same, but more simple and fast

$nID = - $nID
 
    If $nID > 0 Then
        $nID -=1
    EndIf

and Func _GetIconID($nID, $sFile='')

2. Func _GetNewTrayIndex()

$TRAYNOTIFYIDS[0][0] += 1
        Local $nSize = UBound($TRAYNOTIFYIDS)
 
        If $TRAYNOTIFYIDS[0][0] > $nSize - _
10 _
 Then _
           Redim $TRAYNOTIFYIDS[$nSize + 10][9]

on the idea Redim should create a buffer for 10 objects, in this implementation Redim will  keep the buffer in 10 objects and buffer  will never fill

If $TRAYNOTIFYIDS[0][0] > $nSize - _
 1 _
Then _
            Redim $TRAYNOTIFYIDS[$nSize + 10][9]

In this implementation Redim add buffer, then buffer will filled and Redim again add buffer

3. Func _TrayIconDelete($nID)

Func _TrayIconDelete($nID)
    If $nID = -1 Then $nID = $TRAYLASTID
    If $TRAYMSGWND = 0 Or $nID <= 0 Then Return 0
   ;red+
    Local $stNID = DllStructCreate($sNOTIFYICONDATAW)

    DllStructSetData($stNID, 1, DllStructGetSize($stNID))
    DllStructSetData($stNID, 2, $TRAYMSGWND)
    DllStructSetData($stNID, 3, $nID)
   ;red-
    Local $nResult = 0

    Local $i
    For $i = 1 To $TRAYNOTIFYIDS[0][0]
        If $nID = $TRAYNOTIFYIDS[$i][0] Then
;green+
            $stNID = DllStructCreate($sNOTIFYICONDATAW)

            DllStructSetData($stNID, 1, DllStructGetSize($stNID))
            DllStructSetData($stNID, 2, $TRAYMSGWND)
            DllStructSetData($stNID, 3, $nID)
;green-

The Red block and Green are the same. 

4. Func _TrayIconCreate($sToolTip = "", $sIconFile = @AutoItExe, $nIconID = 0, $sCallback = "", $nMsg = 0, $hIcon = 0)

This func have same code as Func _TrayIconSetIcon($nID = -1, $sIconFile = @AutoItExe, $nIconID = 0) 

in the part where the created icon. And in trayiconCreate this code is not needed, it just filled the field, and the icon is created in the second function

5. Func _TrayNotifyIcon($hWnd, $Msg, $wParam, $lParam)

Switch $lParam
        Case $WM_LBUTTONDOWN
            $nClick = 1
        case $WM_LBUTTONUP
            $nClick = 2
        case $WM_LBUTTONDBLCLK
            $nClick = 4
        case $WM_RBUTTONDOWN
            $nClick = 8
        case $WM_RBUTTONUP
            $nClick = 16
        case $WM_RBUTTONDBLCLK
            $nClick = 32
        case $WM_MOUSEMOVE
            $nClick = 64
    EndSwitch

this code is artificially restricts messages of mouse

Func GetMouseCode($WM_Code)
    Switch $WM_Code
        Case $WM_MOUSEFIRST
            $nClick = 1
        Case $WM_MOUSEMOVE
            $nClick = 1
        Case $WM_LBUTTONDOWN
            $nClick = 2
        case $WM_LBUTTONUP
            $nClick = 4
        case $WM_LBUTTONDBLCLK
            $nClick = 8
        case $WM_RBUTTONDOWN
            $nClick = 16
        case $WM_RBUTTONUP
            $nClick = 32
        case $WM_RBUTTONDBLCLK
            $nClick = 64
        case $WM_MBUTTONDOWN
            $nClick = 128
        case $WM_MBUTTONUP
            $nClick = 256
        case $WM_MBUTTONDBLCLK
            $nClick = 512
        case $WM_MOUSEWHEEL
            $nClick = 1024
        case $WM_XBUTTONDOWN
            $nClick = 2048
        case $WM_XBUTTONUP
            $nClick = 4096
        case $WM_XBUTTONDBLCLK
            $nClick = 8192
        case $WM_MOUSEHWHEEL
            $nClick = 16384
    EndSwitch
    Return $nClick
EndFunc

Its more completle codes

Edited by nickston
  • 2 weeks later...
Posted

Added an updated zipfile to post 289.

The zip contains updates for tray menus suggested by nickston. Most important is an update that makes it possible to use a flashing tray menu icon.

nickston, I have not updated _GetIconID. Not using the $sFile parameter will cause a warning by Au3Check. Removing the parameter will be script breaking. I have not removed redundant code in _TrayIconCreate, and I have not added new mouse messages.

Posted

How I ReDim is an idea by KaFu by which you take the upper bound, multiple by 1.3 and round to the nearest whole number e.g.

ReDim $aArray[Ceiling(UBound($aArray) * 1.3)][n]

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Posted

Your UDF, whereby nickston adds 10 new empty elements at every ReDim. I am merely suggesting an optimised approach.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Posted (edited)

Now I understand, sorry. I think the point by nickston was, that the 10 last rows of the array were never used, because the array was already increased, when the 9'th last row was used. The update ensures that the array isn't increased until the last row is used (not the 9'th last).

Since we are talking about tray menus I think that 10 - 20 rows is enough in most cases. This means that in worst case we have one ReDim.

Edit: Updated zipfile in post 289. Now you can use a flashing tray menu icon.

Edited by LarsJ
Posted

 

How I ReDim is an idea by KaFu by which you take the upper bound, multiple by 1.3 and round to the nearest whole number e.g.

ReDim $aArray[Ceiling(UBound($aArray) * 1.3)][n]

multiplication worse than  addition. moreover, increasing each time will grow. arrray will use memory but the array will not be filled.

Posted

Now I understand, sorry. I think the point by nickston was, that the 10 last rows of the array were never used, because the array was already increased, when the 9'th last row was used. The update ensures that the array isn't increased until the last row is used (not the 9'th last).

Since we are talking about tray menus I think that 10 - 20 rows is enough in most cases. This means that in worst case we have one ReDim.

Edit: Updated zipfile in post 289. Now you can use a flashing tray menu icon.

At oridginal code array will redim'ed every time. but the idea was to redim'ed one times out of ten.

Posted

Added an updated zipfile to post 289.

The zip contains updates for tray menus suggested by nickston. Most important is an update that makes it possible to use a flashing tray menu icon.

nickston, I have not updated _GetIconID. Not using the $sFile parameter will cause a warning by Au3Check. Removing the parameter will be script breaking. I have not removed redundant code in _TrayIconCreate, and I have not added new mouse messages.

Au3Check will not cause any warnings (works for me without issues). on the other hand Func _GetIconID($nID, $sFile=''), in this form, you can pass a single parameter or use the old fashioned way

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
  • Recently Browsing   0 members

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