Jump to content
Sign in to follow this  

[SOLVED] Changing icons of non-GUI windows

Recommended Posts

Hey there,

Thanks for reading :idea:

This is my script so far: (credit to trancexx, who posted it somewhere else before)

_GUISetIcon(WinGetHandle("[ACTIVE]", ""), "don't", "care") ; name, not ordinal value

Func _GUISetIcon($hGui, $sModule, $iName) ; for loaded modules in this shape
    $a_hCall = DllCall("user32.dll", "hwnd", "LoadImage", _
            "hwnd", 0, _
            "str", $iName, _
            "dword", 1, _ ; IMAGE_ICON
            "int", 32, _ ;32
            "int", 32, _ ;32
            "dword", 0x10) ; LR_DEFAULTCOLOR

    Local $hIcon = $a_hCall[0]

    DllCall("user32.dll", "hwnd", "SendMessage", _
            "hwnd", $hGui, _
            "dword", 0x0080, _ ; WM_SETICON
            "dword", 0x1, _ ; 1 = ICON_BIG, 0 = ICON_SMALL
            "ptr", $hIcon)

EndFunc   ;==>_GUISetIcon

I've checked, the first function gives a handle, what I've managed to get done (by playing around with dword 0x0, iconbig/iconsmall, and the sizes from loadimage) is to change the icon at the top left of a window, which then few seconds later vanishes, aswell as the alt-tab icon vanishing completely, and the icon permanentely changed in the taskbar.

What I'm trying to do is the alt-tab icon, the rest don't matter to me...

I know this is not strictly an autoit problem, but maybe someone has an idea anyhow?

Thanks alot for reading and any answers :)

Kind regards,


Edited by Miranda

Share this post

Link to post
Share on other sites

Might want to add that I tried this on a Windows 7 64 bit, and a Windows XP 32 bit, the difference was that on windows xp the alt-tab icon didn't vanish.

Oh, and if anyone has a different reliable method of changing the alt-tab icon to something else, please do let me know.

Thanks :idea:

Share this post

Link to post
Share on other sites

The solution is so damn simple it hurts...

The icon only stays changed while the script is running, a simple while + sleep loop makes it all work :idea:

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...