TaskbarWindows.Items - Real Index

delphi package - easy access to kernel objects etc.
Post Reply
Shenck
Posts: 15
Joined: Tue Apr 19, 2005 2:59 pm

TaskbarWindows.Items - Real Index

Post by Shenck »

Hello Madshi,

TaskbarWindows.Items it’s not sorted the same way the buttons are placed on the taskbar. I tried to find the real index of the buttons but i was not successful.

How can I do that?

Code: Select all


var
  k:integer;
begin
  for k := 0 to TaskbarWindows.ItemCount - 1 do
  begin
    if not TaskbarWindows.Items[k].InTaskbar then continue;
    if not TaskbarWindows.Items[k].IsStillValid then continue;
    ShowMessage(
                    'Position in taskbar='+
                    inttostr(k)+//IMPORTANT! k is incorrect. Needs to be replaced with the correct index
                    #13'Handle = '+
                    inttohex(TaskbarWindows.Items[k].Handle,8)+
                    #13'Text='+
                    TaskbarWindows.Items[k].Text
                   );
  end;
end;
THX!
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Which OS are we talking about?
Shenck
Posts: 15
Joined: Tue Apr 19, 2005 2:59 pm

Post by Shenck »

XP-SP2
Shenck
Posts: 15
Joined: Tue Apr 19, 2005 2:59 pm

Post by Shenck »

TaskbarWindows.Items[0] is the focused item. The index changes on focus change.
I want to know the position of the Item on the taskbar.
How can i obtain the correct index?
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

I'm just asking the tray area to list the tray icons. I'm not sure whether I can influence the order in which I get the icons reported. But I'll have a look at it.
Post Reply