LoWang Posted October 16, 2009 Posted October 16, 2009 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.
boogieoompa Posted October 16, 2009 Posted October 16, 2009 GUISetIcon but youll need it to be a .ico I believe. example... $gui = GUICreate("Test",500,500,500,500) GuiSetIcon("Myicon.ico", 0)
LoWang Posted October 16, 2009 Author Posted October 16, 2009 I want to change icon of any application. Not just my script I made, so this is not it I think...
Yashied Posted October 16, 2009 Posted October 16, 2009 (edited) It is unlikely that you can do it. Even if you try, you will get an error - Access is denied. Edited October 16, 2009 by Yashied My UDFs: Reveal hidden contents iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
LoWang Posted October 17, 2009 Author Posted October 17, 2009 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...?
trancexx Posted October 17, 2009 Posted October 17, 2009 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
LoWang Posted October 19, 2009 Author Posted October 19, 2009 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?
picaxe Posted October 19, 2009 Posted October 19, 2009 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now