public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* mintty window handle
@ 2012-02-18 20:18 Kevin Schnitzius
       [not found] ` <1329808688.9185.YahooMailNeo@web162103.mail.bf1.yahoo.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Schnitzius @ 2012-02-18 20:18 UTC (permalink / raw)
  To: cygwin

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.


Anyone have any clues about how to find this handle programmatically?
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mintty window handle
       [not found] ` <1329808688.9185.YahooMailNeo@web162103.mail.bf1.yahoo.com>
@ 2012-02-21 20:40   ` Kevin Schnitzius
  2012-02-22  2:05     ` Andrey Repin
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Schnitzius @ 2012-02-21 20:40 UTC (permalink / raw)
  To: cygwin

>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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mintty window handle
  2012-02-21 20:40   ` Kevin Schnitzius
@ 2012-02-22  2:05     ` Andrey Repin
  0 siblings, 0 replies; 3+ messages in thread
From: Andrey Repin @ 2012-02-22  2:05 UTC (permalink / raw)
  To: Kevin Schnitzius, cygwin

Greetings, 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

That's a very ugly way that was appropriate for finding console windows.
For normal GUI windows, I think, there's more straightforward ways.


--
WBR,
Andrey Repin (anrdaemon@freemail.ru) 22.02.2012, <05:48>

Sorry for my terrible english...


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-02-22  2:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-18 20:18 mintty window handle Kevin Schnitzius
     [not found] ` <1329808688.9185.YahooMailNeo@web162103.mail.bf1.yahoo.com>
2012-02-21 20:40   ` Kevin Schnitzius
2012-02-22  2:05     ` Andrey Repin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).