TrayIcons does not work on Windows XP SP2

delphi package - easy access to kernel objects etc.
Post Reply
kAzek
Posts: 1
Joined: Wed Nov 16, 2005 8:12 am

TrayIcons does not work on Windows XP SP2

Post by kAzek »

Welcome
I Wanted to test interface ITrayIcons I used example codes:

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
begin
//This MessageBox display text "we have 0 tray icons"
MessageBox(0, pchar('we have ' + IntToStr(TrayIcons.ItemCount) + ' tray icons'), 'info', 0);
//This MessageBox is empty
MessageBox(0, pchar(TrayIcons[0].Window.OwnerProcess.ExeFile), 'the first tray icon belongs to', 0);
//This MessageBox display text ""
MessageBox(0, pchar('"' + TrayIcons[0].Hint + '"'), 'the first tray icon''s hint is', 0);
//This do not work
with TrayIcons[0] do begin
  Hide;
  MessageBox(0, 'first tray icon is temporarily hidden now', 'info', 0);
  Show;
end;
end;
It on Windows 98 works great, unfortunately on Windows XP does not work.
I ask help me
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Thanks for the report, I'll check that out.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

It does work for me!! Are you sure it doesn't work on your PC? Can you please retest, just to be sure?
neji
Posts: 155
Joined: Wed Mar 09, 2005 11:39 am
Contact:

Post by neji »

for me, too
Nokt
Posts: 3
Joined: Sun Nov 27, 2005 8:49 am
Location: Poland

Post by Nokt »

Same problem for me. Doesn't work, checked few times with time space, various logins, two PCs (with two D2k5 compilers) :P
Both W2K Service Pack 4.

Same return values. When debugging is on I get 1 or 2 "plapla access of 000000" errors for each TrayIcons call.
Callstack always shows Button1Click->TrayIcons->TITrayIcons.Create->TITrayIcons.RefreshItems->CopyImageList->Exception_procs (without the CopyImageList in the 2nd error).

Do I have to initiate TrayIcons or anything in any way? Must I do sth with the interfaces? (I'm new to COM and Mad..)
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

I think this will probably be fixed in the next madCollection build, which will probably be released tomorrow evening.
Nokt
Posts: 3
Joined: Sun Nov 27, 2005 8:49 am
Location: Poland

Post by Nokt »

On 2st comp (will check on 1nd), the new f version made the hint, id and itemcount work.
TImage.Picture.Icon.Handle:=TrayIcons[n].Icon still doesn't work (TImage disapears),
TrayIcon[n].Hide doesn't work (but deletes an icon created by a window that doesn't exist anymore (refreshes the tray, like when moving the mouse over it, so it's probably sending a message)).

No error showing, even when debugging.
TrayIcons.LastErrorStr='System nie może odnaleźć określonego pliku.'
(the system cannot find the specified file :P)
TrayIcons[n].LastErrorStr='', or 'object is invalid' for n>ItemCount (so it works :) ).
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

The icon stuff only works if madDisAsm is installed, which is part of both madExcept and madCodeHook. So don't just install madKernel, but also either madExcept or madCodeHook. It gets even more complicated: If you want the icon stuff to work in win9x, too, you need to install madCodeHook, and additionally you need to copy the madCHook.dll into the same folder where your app is located (the madCHook.dll is only needed when using the non-commercial edition of madCollection).
Nokt
Posts: 3
Joined: Sun Nov 27, 2005 8:49 am
Location: Poland

Post by Nokt »

Works fine, thanks! Tested on both computers ;)
Post Reply