delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/02/21/21:05:15

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=1.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_THEBAT,TW_HW
X-Spam-Check-By: sourceware.org
Date: Wed, 22 Feb 2012 05:50:27 +0400
From: Andrey Repin <anrdaemon AT freemail DOT ru>
Reply-To: Andrey Repin <cygwin AT cygwin DOT com>
Message-ID: <1409512550.20120222055027@mtu-net.ru>
To: Kevin Schnitzius <kometes AT yahoo DOT com>, cygwin AT cygwin DOT com
Subject: Re: mintty window handle
In-Reply-To: <1329856799.42733.YahooMailNeo@web162104.mail.bf1.yahoo.com>
References: <1329596319 DOT 47207 DOT YahooMailNeo AT web162105 DOT mail DOT bf1 DOT yahoo DOT com> <1329808688 DOT 9185 DOT YahooMailNeo AT web162103 DOT mail DOT bf1 DOT yahoo DOT com> <1329856799 DOT 42733 DOT YahooMailNeo AT web162104 DOT mail DOT bf1 DOT yahoo DOT com>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Note-from-DJ: This may be spam

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 AT freemail DOT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019