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

X-Recipient: archive-cygwin AT delorie DOT 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 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>
Message-ID: <1329856799.42733.YahooMailNeo@web162104.mail.bf1.yahoo.com>
Date: Tue, 21 Feb 2012 12:39:59 -0800 (PST)
From: Kevin Schnitzius <kometes AT yahoo DOT com>
Reply-To: Kevin Schnitzius <kometes AT yahoo DOT com>
Subject: Re: mintty window handle
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
In-Reply-To: <1329808688.9185.YahooMailNeo@web162103.mail.bf1.yahoo.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
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


- Raw text -


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