How to get a TrayIcon handle?
How to get a TrayIcon handle?
Hello Madshi and everyone!
Madshi, are you able to tell me the way you do to get a trayicon handle of another process?
Thank you!
Madshi, are you able to tell me the way you do to get a trayicon handle of another process?
Thank you!
use the source luke , hehe
I don't know if I'm allowed to post madshi's code here but I think this is the most important part of the function
I don't know if I'm allowed to post madshi's code here but I think this is the most important part of the function
Code: Select all
c1 := SHGetFileInfo(pchar(file_), GetFileAttributes(pchar(file_)), sfi, sizeOf(sfi), c1);
Code: Select all
function GetTrayIcon(PID:dword):cardinal;
var
exe:string;
i:integer;
begin
exe:=process(pid).ExeFile;
Result:=0;
for i:=0 to TrayIcons().ItemCount-1 do
begin
if TrayIcons().Items[i].Window.OwnerProcess.ExeFile=exe then
begin
Result:=TrayIcons().Items[i].Icon;
exit;
end;
end;
end;
Shenck, you can have that easier:
Code: Select all
function GetTrayIcon(PID:dword):cardinal;
begin
result := Process(PID).TrayIcons[0].Icon;
end;
Oh, it's quite complicated - and it differs depending on the OSs!
Check out this one to find more information about it:
http://members.fortunecity.com/nickrepin/winprog.html
Check out this one to find more information about it:
http://members.fortunecity.com/nickrepin/winprog.html
THank you!madshi wrote:Oh, it's quite complicated - and it differs depending on the OSs!
Check out this one to find more information about it:
http://members.fortunecity.com/nickrepin/winprog.html
http://www.delphipraxis.net/topic44544_ ... t=trayicon
maybe this can help you , too (look at the attachment in the second post)
maybe this can help you , too (look at the attachment in the second post)