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

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.

Andrey Repin ( 22.02.2012, <05:48>

Sorry for my terrible english...

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]