Hi Ivanov_G .
Yes it runs.
And the big problem is that without those icons (2) there is no functionality !
Main Topics
Browse All TopicsHi.
My application stays minimized in the system tray.
Sometimes explorer crash and when it reloads it always forget to create the icons of my application.
How can i add a check to see if my icons is missing ?
Thanks in advance.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
that "bug" happens to be an explorer bug. as many others.
one way to go is to see when explorer is restarted and then recreate the icons. (hooks will be on this one, or a slow timer, say 1 check in a 1-3 or more seconds, though this approach will keep the cpu busy)
another way is to again check in a timer that the icons have valid handles (though this might be true). I never tried, but you could check to see exactly what becomes invalid after explorer restart.
best way to go is probably as described in this blog:
http://blogs.msdn.com/trib
Hi Geobul... Yes Api functions ...
Here is a small portion of the code:
~-~-~-~-~-~-~-~-~-~-~-~-~-
uses ..... ShellApi {For Tray notification definitions }
const
WM_ICONTRAY=WM_USER+1;
public
{ Public declarations }
F1Tray:TNotifyIconData;
F1Icon:TIcon;
F2Tray:TNotifyIconData;
F2Icon:TIcon;
....
procedure TForm1.FormCreate(Sender: TObject);
Begin
//Enable tray icon 1
With F1Tray do
begin
cbSize:=SizeOf(F1Tray);
Wnd:=Handle;
uID:=0;
uFlags:=NIF_MESSAGE+NIF_IC
uCallbackMessage:=WM_ICONT
F1Icon:=TIcon.Create;
Image.GetIcon(0,F1Icon);
hIcon:=F1Icon.Handle;
StrPCopy(szTip,'This is the first icon.');
end;
Shell_NotifyIcon(NIM_ADD,@
//Enable tray icon 2
With F2Tray do
begin
cbSize:=SizeOf(F2Tray);
Wnd:=Handle;
uID:=1;
uFlags:=NIF_MESSAGE+NIF_IC
uCallbackMessage:=WM_ICONT
F2Icon:=TIcon.Create;
Image.GetIcon(0,F2Icon);
hIcon:=F2Icon.Handle;
StrPCopy(szTip,'This is the second icon');
end;
Shell_NotifyIcon(NIM_ADD,@
end;
~-~-~-~-~-~-~-~-~-~-~-~-~-
Hi Ciuly... I've seen this happen many times with other programs.
But Explorer doesnt like my app at all... It always destroy the icons when it crash.
Interesting link.
I'll create a timer that will do something ONLY IF my app capture the message of TaskbarCreated...
This way i want use cpu power....
How can i do that ?
The article says the TaskbarCreated string and then broadcasts this message to all top-level windows.
Mine is minimized....
Thanks for any help :)
Hi again,
The following is a solution from another expert I haven't tried myself but it's worth:
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
protected
FMsgTaskbarCreated : dword;
procedure WndProc(var Message: TMessage); override;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
FMsgTaskbarCreated := RegisterWindowMessage('Tas
end;
procedure TForm1.WndProc(var Message: TMessage);
begin
inherited;
if Message.Msg = FMsgTaskbarCreated then
Caption := Caption + '+';
end;
end.
Regards, Geo
Thanks Geo it works in a way....
When i terminate explorer (with my app running) and then reload explorer
I get "System error 1400 - Invalid Window Handle"
I use the proc like that :
procedure TForm1.WndProc(var Message: TMessage);
begin
inherited;
if Message.Msg = FMsgTaskbarCreated then
begin
Shell_NotifyIcon(NIM_ADD,@
Shell_NotifyIcon(NIM_ADD,@
end;
end;
--------------------------
ONLY F2 Icon loads to the tray, this restores half the functionality of my app...
Why F1 doesnt load ?
Strange... very strange
I've done the following :
procedure TForm1.WndProc(var Message: TMessage);
begin
inherited;
if Message.Msg = FMsgTaskbarCreated then
begin
//Enable tray icon 1
With F1Tray do
begin
cbSize:=SizeOf(F1Tray);
Wnd:=Handle;
uID:=0;
uFlags:=NIF_MESSAGE+NIF_IC
uCallbackMessage:=WM_ICONT
F1Icon:=TIcon.Create;
Image.GetIcon(0,F1Icon);
hIcon:=F1Icon.Handle;
StrPCopy(szTip,'This is the first icon.');
end;
Shell_NotifyIcon(NIM_ADD,@
//Enable tray icon 2
With F2Tray do
begin
cbSize:=SizeOf(F2Tray);
Wnd:=Handle;
uID:=1;
uFlags:=NIF_MESSAGE+NIF_IC
uCallbackMessage:=WM_ICONT
F2Icon:=TIcon.Create;
Image.GetIcon(0,F2Icon);
hIcon:=F2Icon.Handle;
StrPCopy(szTip,'This is the second icon');
end;
Shell_NotifyIcon(NIM_ADD,@
end;
end;
Now i dont get the "Invalid Window Handle" error !
But it only loads only the first paragraph !!!!!!!
If i put the icon1 paragraph first then it only loads paragraph1 else the second...
Business Accounts
Answer for Membership
by: Ivanov_GPosted on 2006-07-07 at 05:05:30ID: 17057752
Are you sure you application is running after Explorer reloads? Did you checked it in Task Manager?