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: mintty window handle


>From: Kevin Schnitzius 

>
>I would like to be able change the icon dynamically on my mintty 
>windows.? However, old trick (google KB125103) for finding console 
>window handles won't work anymore as it relies on the windows console 
>window.? I have verified that WM_SETICON works with the correct window handle.? I have played 
>around with the walking through windows but I can't figure out how to do it.

For those curious, this MSVC solution worked:

??????? // Format a "unique" NewWindowTitle.
??????? sprintf(pszNewWindowTitle, "%d/%d",
??????????? GetTickCount(), GetCurrentProcessId());

??????? sprintf(pszNewCommand, "c:\\cygwin\\bin\\bash.exe -c \'echo -ne \"\\e]2;%s\\a\"\'", pszNewWindowTitle);
??????? system(pszNewCommand);

??????? // Ensure window title has been updated.
??????? Sleep(40);

??????? // Look for NewWindowTitle.
??????? hwndFound = FindWindow(NULL, pszNewWindowTitle);? // our program

There is no way that I know of to get the original title so I had to make my program set the title to something meaningful 
while changing the icon.? There are other difficulties as well when freeing icon handles but I have a solution if anyone is
interested.

Kevin


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