Jump to content

Recommended Posts

Posted

Hello, I know I can change a window title by WinSetTitle, but is it somehow possible to also change icon of the window and in the taskbar? Changing the icon in the executable file via resource hacker or other tools unfortunatelly corrupted it so I want to do it runtime.

Posted

Hm that's bad. I hoped maybe somebody knows some hack :-] Maybe if my script runs the app process then it would have permissions to do this with it...?

Posted

This?

_GUISetIcon(WinGetHandle("[ACTIVE]", ""), "shell32.dll", 322) ; name, not ordinal value



Func _GUISetIcon($hGui, $sModule, $iName) ; for loaded modules in this shape

    Local $a_hCall = DllCall("kernel32.dll", "hwnd", "GetModuleHandleW", "wstr", $sModule)

    Local $hModule = $a_hCall[0]

    $a_hCall = DllCall("user32.dll", "hwnd", "LoadImageW", _
            "hwnd", $hModule, _
            "int", $iName, _
            "dword", 1, _ ; IMAGE_ICON
            "int", 32, _
            "int", 32, _
            "dword", 0) ; LR_DEFAULTCOLOR

    Local $hIcon = $a_hCall[0]

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

EndFunc   ;==>_GUISetIcon

That will change the SciTE icon if you are running scripts there.

♡♡♡

.

eMyvnE

Posted

  On 10/17/2009 at 5:24 PM, 'trancexx said:

This?

_GUISetIcon(WinGetHandle("[ACTIVE]", ""), "shell32.dll", 322) ; name, not ordinal value



Func _GUISetIcon($hGui, $sModule, $iName) ; for loaded modules in this shape

    Local $a_hCall = DllCall("kernel32.dll", "hwnd", "GetModuleHandleW", "wstr", $sModule)

    Local $hModule = $a_hCall[0]

    $a_hCall = DllCall("user32.dll", "hwnd", "LoadImageW", _
            "hwnd", $hModule, _
            "int", $iName, _
            "dword", 1, _ ; IMAGE_ICON
            "int", 32, _
            "int", 32, _
            "dword", 0) ; LR_DEFAULTCOLOR

    Local $hIcon = $a_hCall[0]

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

EndFunc   ;==>_GUISetIcon

That will change the SciTE icon if you are running scripts there.

Hello, thanks for reply but still you did not understand my request - I want to know some way how to change icon of ANY application, not just my script. Can this code be used someway like running some exe file from my script via run and then change icon of its window for example?
Posted
  On 10/19/2009 at 11:06 AM, 'LoWang said:

I want to know some way how to change icon of ANY application, not just my script.

Substitute the window handle of your application for the first param of the function.

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