X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=3.2 required=5.0	tests=AWL,BAYES_20,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,TW_HW,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
References: <1329596319.47207.YahooMailNeo@web162105.mail.bf1.yahoo.com> <1329808688.9185.YahooMailNeo@web162103.mail.bf1.yahoo.com>
Message-ID: <1329856799.42733.YahooMailNeo@web162104.mail.bf1.yahoo.com>
Date: Tue, 21 Feb 2012 12:39:59 -0800 (PST)
From: Kevin Schnitzius <kometes@yahoo.com>
Reply-To: Kevin Schnitzius <kometes@yahoo.com>
Subject: Re: mintty window handle
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
In-Reply-To: <1329808688.9185.YahooMailNeo@web162103.mail.bf1.yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id q1LKeMXu009996

>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


