This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Can I change the windows icon from command line?


Am 02.11.2017 um 03:39 schrieb Brian Inglis:
On 2017-11-01 15:10, Thomas Wolff wrote:
Am 01.11.2017 um 22:05 schrieb bzs@theworld.com:
A trivial little shell script I use for setting xterm title/icon via escape
sequences:
...
That sequence is setting the icon *label*, not the icon. Mintty cannot support
it because there is no corresponding Windows function.
But there is a sequence of Windows functions from:

	http://www.cplusplus.com/forum/general/28470/

summarizing (but this is from 2010 so may need tweaks):

"There are two icons in the window, 32x32 and 16x16.
If you want to change the the icon at the task bar and title bar you should do:

	hIcon = (HICON)LoadImage(NULL, "menu_two.ico", IMAGE_ICON, 32, 32,
LR_LOADFROMFILE);
	hIconSm = (HICON)LoadImage(NULL, "menu_two.ico", IMAGE_ICON, 16, 16,
LR_LOADFROMFILE);

LoadImage just loads the icon from the file. You need to assign the icon to the
window. You do this by sending a WM_SETICON message:

	SendMessage( yourwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm );
	SendMessage( yourwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon );

Reference: http://msdn.microsoft.com/en-us/library/ms632643(VS.85).aspx

I found out the difference with the ICON_SMALL and ICON_BIG, if you only set
ICON_SMALL then the Alt-Tab icon is stretched and looks bad.
If you set the ICON_BIG as well as ICON_SMALL, then everything looks nice."

For Xwindow icons, some approaches from google, depending on needs:

http://www.ideatrash.net/2014/10/howto-get-custom-icons-with-each-new.html
http://www.troubleshooters.com/linux/terminal_icon.htm
http://blog.samadamday.com/2014/automatically-set-windows-icons-based-on-gnome-theme/
https://superuser.com/questions/344320/how-do-i-change-the-icon-of-an-xterm
http://www.leonerd.org.uk/code/xseticon/
Thanks, Brian, for the links and the sample code which will make it easier.
This is about changing the icon, to get that sorted out.
I referred to changing the icon label (an existing sequence supported by xterm), i.e. the text shown in the taskbar, which cannot be changed in Windows as far as I know as it's always the same as the window title.
Thomas

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]