Icon handling in b153

May 20, 2008
11,288
95
Syracuse, NY, USA
When issued in a TCC console (or batch file), this command,

TYPE http://weather.noaa.gov/weather/current/KSYR.html | GREPP /V "^ *$" > avetemp.txt

causes the console icon to change to the default (CMD) icon and stay there. GREPP in a plugin command and I assure you it doesn't mess with any icons.

In fact, this command does the same thing:

echo foo | ffind /t"foo"
 

rconn

Administrator
Staff member
May 14, 2008
12,316
148
vefatica wrote:

> When issued in a TCC console (or batch file), this command,
>
> TYPE [URL='http://weather.noaa.gov/weather/current/KSYR.html']http://weather.noaa.gov/weather/current/KSYR.html[/url][/URL] | GREPP /V "^ *$" > avetemp.txt
>
> causes the console icon to change to the default (CMD) icon and stay there. GREPP in a plugin command and I assure you it doesn't mess with any icons.
>
> In fact, this command does the same thing:
>
> echo foo | ffind /t"foo"

The change in 153 was the one you requested to have TCC set its icon
back to the default when it exits. If you pipe to a child TCC process,
it will reset the icon when the child exits.

Rex Conn
JP Software
 
May 20, 2008
11,288
95
Syracuse, NY, USA
On Thu, 06 Nov 2008 22:32:09 -0600, "JP Software Forums" <neil@jpsoft.com>,rconn
<> wrote:


>> echo foo | ffind /t"foo"
>---End Quote---
>The change in 153 was the one you requested to have TCC set its icon
>back to the default when it exits. If you pipe to a child TCC process,
>it will reset the icon when the child exits.

My suggestion was to, at exit time, reinstate (if possible) the icon found in
the console at startup time. I don't think I mentioned the default console icon
at all. TCC not displaying its icon is unacceptable. If you can't get it to
restore the previous icon, then please leave the TCC icon.
 

rconn

Administrator
Staff member
May 14, 2008
12,316
148
vefatica wrote:

> On Thu, 06 Nov 2008 22:32:09 -0600, "JP Software Forums" <neil@jpsoft.com>,rconn
> <> wrote:
>
>
>
> ---Quote---
>>> echo foo | ffind /t"foo"
>> ---End Quote---
>> The change in 153 was the one you requested to have TCC set its icon
>> back to the default when it exits. If you pipe to a child TCC process,
>> it will reset the icon when the child exits.
> ---End Quote---
> My suggestion was to, at exit time, reinstate (if possible) the icon found in
> the console at startup time. I don't think I mentioned the default console icon
> at all. TCC not displaying its icon is unacceptable. If you can't get it to
> restore the previous icon, then please leave the TCC icon.

TCC does not restore the default console icon, it restores the icon
originally set (by Windows) for TCC at startup.

Rex Conn
JP Software
 
May 20, 2008
11,288
95
Syracuse, NY, USA
On Fri, 07 Nov 2008 06:52:49 -0600, "JP Software Forums" <neil@jpsoft.com>,rconn
<> wrote:


>---Quote---
>> On Thu, 06 Nov 2008 22:32:09 -0600, "JP Software Forums" <neil@jpsoft.com>,rconn
>> <> wrote:
>>
>>
>>
>> ---Quote---
>>>> echo foo | ffind /t"foo"
>>> ---End Quote---
>>> The change in 153 was the one you requested to have TCC set its icon
>>> back to the default when it exits. If you pipe to a child TCC process,
>>> it will reset the icon when the child exits.
>> ---End Quote---
>> My suggestion was to, at exit time, reinstate (if possible) the icon found in
>> the console at startup time. I don't think I mentioned the default console icon
>> at all. TCC not displaying its icon is unacceptable. If you can't get it to
>> restore the previous icon, then please leave the TCC icon.
>---End Quote---
>TCC does not restore the default console icon, it restores the icon
>originally set (by Windows) for TCC at startup.

Whatever the explanation, please return to the (long-time) behavior where the
TCC icon always shows in the console when TCC is the only app running in the
console.
 
May 20, 2008
11,288
95
Syracuse, NY, USA
<neil@jpsoft.com>

Whatever the explanation, please return to the (long-time) behavior where the TCC icon always shows in the console when TCC is the only app running in the console.

The recent change does not seem to have fixed anything. I don't have TSE, but in my experiments with k95.exe, after shelling to TCC and returning to K95, the K95 icon still fails to reappear. Now, instead of the TCC icon remaining, the default console icon remains (no better IMHO, worse considering that when the parent is TCC, it actually removes its own icon).

Experiment shows that after
</neil@jpsoft.com>
<neil@jpsoft.com>HICON hOldIcon = GetConsoleIcon(); // with WM_GETICON</neil@jpsoft.com>
<neil@jpsoft.com>SetConsoleIcon(hMyIcon);</neil@jpsoft.com>
<neil@jpsoft.com></neil@jpsoft.com>​
<neil@jpsoft.com>hOldIcon is invalid (SetConsoleIcon(hOldIcon) = 87). (hOldIcon *is* valid before the SetConsoleIcon().)

So it would seem unreasonable to expect an app to restore another app's console icon after setting its own. It seems quite reasonable that each app be responsible for ensuring that its icon appears when appropriate. If a parent app doesn't re-set its own icon after a spawned app in the same console exits that's the parent's problem.



</neil@jpsoft.com>
 
May 20, 2008
11,288
95
Syracuse, NY, USA
I said:

Experiment shows that after
<neil@jpsoft.com>HICON hOldIcon = GetConsoleIcon(); // with WM_GETICON</neil@jpsoft.com>
<neil@jpsoft.com>SetConsoleIcon(hMyIcon);</neil@jpsoft.com>
<neil@jpsoft.com></neil@jpsoft.com>​
hOldIcon is invalid (SetConsoleIcon(hOldIcon) = 87). (hOldIcon *is* valid before the SetConsoleIcon().)

So it would seem unreasonable to expect an app to restore another app's console icon after setting its own.

But the strategy apparently works if I get my own duplicate handle to the one I want to later restore. The little test app below, when run from TCC, sets the console icon to the default and then re-instates TCC's icon.

INT wmain ( INT argc, WCHAR **argv ) {
HICON hOldIcon = GetConsoleIcon(); // uses WM_GETICON
HICON hMyOldIcon = DuplicateIcon(0, hOldIcon);

DWORD (STDAPICALLTYPE * SetConsoleIcon) ( HICON );
HMODULE hLib = GetModuleHandle(L"kernel32.dll");
(FARPROC&) SetConsoleIcon = GetProcAddress(hLib, "SetConsoleIcon");

// sets the icon to the default and apparently closes hOldIcon
SetConsoleIcon(NULL);
Sleep(5000);

// this works to restore TCC's icon
// without it TCC's icon is not restored at exit
SetConsoleIcon(hMyOldIcon);
Sleep(5000);
return 0;
}
 
May 20, 2008
11,288
95
Syracuse, NY, USA
A couple notes: CopyIcon() seems to work as well as DuplicateIcon(). If you're using WM_GETICON to get the console icon when TCC starts, ICON_SMALL rarely works (don't know why). ICON_BIG and ICON_SMALL2 have worked in all my tests.

<neil@jpsoft.com></neil@jpsoft.com><neil@jpsoft.com></neil@jpsoft.com><neil@jpsoft.com></neil@jpsoft.com>The little test app below, when run from TCC, sets the console icon to the default and then re-instates TCC's icon.

INT wmain ( INT argc, WCHAR **argv ) {
HICON hOldIcon = GetConsoleIcon(); // uses WM_GETICON
HICON hMyOldIcon = DuplicateIcon(0, hOldIcon);

DWORD (STDAPICALLTYPE * SetConsoleIcon) ( HICON );
HMODULE hLib = GetModuleHandle(L"kernel32.dll");
(FARPROC&) SetConsoleIcon = GetProcAddress(hLib, "SetConsoleIcon");

// sets the icon to the default and apparently closes hOldIcon
SetConsoleIcon(NULL);
Sleep(5000);

// this works to restore TCC's icon
// without it TCC's icon is not restored at exit
SetConsoleIcon(hMyOldIcon);
Sleep(5000);
return 0;
}
 
Similar threads
Thread starter Title Forum Replies Date
U An annoying bug with TCC's icon handling in the taskbar Support 25
vefatica Help pages, icon missing Support 8
CWBillow Admin rights for icon Support 1
J The triple mystery of the missing tray icon Support 9
mscheuner TakeCommand no longer showing its icon in Win7 Taskbar Support 12
vefatica TCC v10 finding its own icon? Support 4
S CMD.EXE icon Support 1
vefatica The TCC icon? Support 6
vefatica WAD TCC: inconsistent character handling Support 11
M Handling of %~I problem Support 4
J File explorer handling from command line? Support 2
forbin Strange handling of [nonbright] magenta background (v22) Support 2
T WAD Difference between TCC and CMD in handling multi-command lines Support 6
thorntonpg Handling files with embedded spaces Support 1
J junction copy/move handling Support 6
C How to? MOVE and handling out of space Support 2
The Wizard WAD Possible Incorrect COMSPEC handling Support 2
BobK How to? Handling filenames with blanks at command line Support 3
Frank WAD handling variables with $-prefix Support 14
A Discrepancy in handling of "can't copy or move file to itself" Support 4
M How to? A question about error-handling... Support 25
S Description handling Support 3
B Strange handling of a .BAT file Support 5
C handling percent signs in filenames Support 2
C handling percent signs in filenames Support 1
S Ctrl-C handling while piping Support 0
p.f.moore Bug in plugin break handling? Support 0
p.f.moore Error handling in plugins Support 2
dcantor Start problem in b153 Support 4

Similar threads