Jump to content

TraySetIcon(@WindowsDir & "\system32\shell32.dll",$x)


rudi
 Share

Recommended Posts

Hi.

Autoit 3.3.6.1 on Windows XP SP3 (compiled and from SciTE Editor)

$Sleep = 100
For $i = 1 To 238 ; shell32.dll has 238 icons (WinXP)
    ToolTip("      $i=" & $i, MouseGetPos(0), MouseGetPos(1))
    TraySetIcon(@WindowsDir & "\system32\shell32.dll", $i)
    If ($i > 50) And ($i < 60) Then
        $Sleep = 400
        ; slower, to see the # better
    ElseIf ($i > 130) and ($i < 160) Then
        $Sleep = 400
    Else
        $Sleep = 100
    EndIf
    Sleep($Sleep)
Next

This is fact for several WinXP SP3 PCs.

Do I miss something? Is it a bug?

Regards, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

Bump.

could pls somebody tell, if he/she get's the same result? (for the values mentioned *NOT* the icon, that should be set, but the default "autoit" icon)

TIA, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

You didn't describe what you're trying to do, what your code does, and what the expected results are. No wonder you're not getting a reply. Looking at your code though, I think I can guess that you're confused that shell32.dll does not have icons under certain indexes. This is not a bug, there are simply no icons there.

Note, though, that every OS has a different shell32 with different icons.

Link to comment
Share on other sites

@Rudi

Try using the icon number instead of icon name as in -55 to -132. You may have to adjust those numbers by 1 0r 2, I didn't look them up.

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

Hi.

You didn't describe what you're trying to do, what your code does, and what the expected results are. No wonder you're not getting a reply. Looking at your code though, I think I can guess that you're confused that shell32.dll does not have icons under certain indexes. This is not a bug, there are simply no icons there.

Note, though, that every OS has a different shell32 with different icons.

I want to select icon #55 from shell32.dll to be set as the systray icon for that script.

It failed.

So I did this simple script, that loops through the icons in shell32.dll, setting one after another as the "active" icon for the systray icon of the autoit script.

It works fine for the most icons, but 55 and several followers in a row, the "autoit default icon" is / remains set.

Regards, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

Hi.

@Rudi

Try using ... -55 to -132. ...

Now I think I at least have an idea what these two lines mean.

[cite]

Passing a positive number will reference the string equivalent icon name.

Passing a negative number causes 1-based "index" behaviour. Some Dll can have icon extracted just with negative numbers.

[/cite]

What exactly is meant by "sting equivalent icon name"? Aren't icons in DLLs always referenced with their "icon number" ? How could I read from shell32.dll, what would have been the correct "icon name"?

Thanks for you helpful reply, Rudi.

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

Just like GEOSoft said...

HotKeySet("{ESC}","_Exit")

$Sleep = 100
For $i = -1 To -238 Step -1 ; shell32.dll has 238 icons (WinXP)
    ToolTip("      $i=" & $i, MouseGetPos(0), MouseGetPos(1))
    TraySetIcon(@WindowsDir & "\system32\shell32.dll", $i)
    If ($i < -50) And ($i > -60) Then
        $Sleep = 400
        ; slower, to see the # better
    ElseIf ($i < -130) and ($i > -160) Then
        $Sleep = 400
    Else
        $Sleep = 100
    EndIf
    Sleep($Sleep)
Next

Func _Exit()
    Exit
EndFunc
Link to comment
Share on other sites

If you were to open that file (icon groups, not icons) in Resource Hacker instead of an icon editor you would see that there are gaps in the naming sequence(positive numbers >> string name), Shell32.dll is exactly like that. Icon editors almost always reference them by the index number which will always be a complete sequence, those that reference names require that you do some carefull checking. All you have to do is add the negative sign to let AutoIt know you are referencing an index number. When using the icons from an exe file, be careful of the first icon, it can be either 0 or -1 and that is why I said you may have to shift your number by 1 or 2. I have had more failures referencing by icon name than I care to remember.

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