Jump to content

EnumIcons v2


Lazycat
 Share

Recommended Posts

First version of script I'm done for including in Autoit package as example. Since this time script was not changed, except someone added ability (incorrect) to view icon names.

Here a bit redone version with some advantages:

-correct names retreiveing (thanks piccaso for a great callback UDF)

-correct finding number of icons

-ability to copy name/index to clipboard

-fixed drag'n'drop handler

-some GUI tweaks

History:

2.0 - Initial release

2.1 - Fixed bug with CPU hog as result (thanks smashly)

enumicons_v2.zip

2.2 - Fixed to latest DllCall syntax changes (only for 3.2.9.5 an up)

2.2a - Yet another fix for latest beta, since it now support pointer type

enumicons_v2.2a.zip

2.3 - Nothing new, just changed code to use native callback functionality

enumicons_v2.3.zip

Edited by Lazycat
Link to comment
Share on other sites

  • 2 months later...

Thank You Lazycat for your excellent educational example, as it really filled in some blanks for me using the callback function

But I really think 1 small change is required to make your efforts more CPU friendly when pointing at an icon.

As is the CPU usage sky rockets to 100% while pointing at an icon.

Suggested change for your most excellent educational example:

While 1
    $aInfo = GUIGetCursorInfo()
    If IsArray($aInfo) Then
        If ($aInfo[4] >= $ahIcons[0] And $aInfo[4] <= $ahLabels[29]) Then
            ;If $hSelected = $aInfo[4] Then ContinueLoop ; Original line...
            If $hSelected <> $aInfo[4] Then ;;<-- Changed above line for less CPU usage
                $pos = ControlGetPos($hGui, "", $aInfo[4])
                If $pos[2] = 58 Then ; Label
                    GUICtrlSetPos($hOverlay, $pos[0] - 1, $pos[1] + $pos[3] - 60)
                Else ; Icon
                    GUICtrlSetPos($hOverlay, $pos[0] - 14, $pos[1] - 5)
                EndIf
                $hSelected = $aInfo[4]
            EndIf ;<-- Added to close the edited If statement above
        EndIf
    EndIf

Sorry to drag up an old post, but I only noticed this today when using your example from the examples folder in AutoIt 3.2.8.1

Cheers

Link to comment
Share on other sites

Thank You Lazycat for your excellent educational example, as it really filled in some blanks for me using the callback function

But I really think 1 small change is required to make your efforts more CPU friendly when pointing at an icon.

As is the CPU usage sky rockets to 100% while pointing at an icon.

Suggested change for your most excellent educational example:

Cheers

Thanks, it's really eating a lot of CPU :) I'm not noticed this before.

Fixed as you suggested, and updated callback UDF to latest 6.5 version.

Link to comment
Share on other sites

hi nice work

i am using holgers "modernmenu" menu library

to be compatible with the ordinal indexes used there i changed

If $bOrdinal then

GUICtrlSetImage($ahIcons[$iCurIndex], $glFileName, -($iStartIndex + $iCurIndex))

; GUICtrlSetData($ahLabels[$iCurIndex], -($iStartIndex + $iCurIndex) )

GUICtrlSetData($ahLabels[$iCurIndex], ($iStartIndex + $iCurIndex) -1 ) ;;; for modern menu

Else

now the icon index starts with "0" and has positive numbers

Link to comment
Share on other sites

  • 2 weeks later...

@LazyCat

I just played with this for a thread in Help and support and noticed that it seems to be returning a lot of wrong values for the context menu selections.

Just a heads up.

EDIT: Forget this. It must have been an older version. I just tried the latest and it was fine.

Suggestion;

Maybe add 1 more Context item?

Filename & Ordinal value

The clipboard would contain

<filepath & name>, ordinal.

That way if some one was setting an icon they could select that and get something like

C:\Windows\System32\Shell32.dll, -1

to be pasted into

GUISetIcon(Paste here)

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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