Code file:
UnitUnit1;InterfaceUsesWindows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls, comctrls;TypeTform1 =Class(Tform) button1: tbutton; button2: tbutton; button3: tbutton; listview1: tlistview;ProcedureFormcreate (Sender: tobject );ProcedureButton1click (Sender: tobject );ProcedureButton2click (Sender: tobject );ProcedureButton3click (Sender: tobject );End;VaRForm1: tform1;Implementation{$ R *. DFM}UsesCommctrl; {function for obtaining the tray handle}FunctionTrayhwnd: hwnd;VaRH, htmp: hwnd;BeginH: = findwindow ('Shell _ traywnd ',Nil); H: = find1_wex (H, 0, 'traypolicywnd ',Nil); Htmp: = find1_wex (H, 0, 'syspager ',Nil);IfHtmp <> 0ThenH: = htmp; htmp: = find1_wex (H, 0, 'toolbarwindow32 ',Nil);IfHtmp <> 0ThenH: = htmp; Result: = h;End; {Control initialization}ProcedureTform1.formcreate (Sender: tobject );BeginListview1.align: = alleft; listview1.columns. add; listview1.columns. items [0]. caption: = 'tray icon list'; listview1.columns. items [0]. width: = 500; listview1.viewstyle: = vsreport; button1.caption: = 'display tray list'; button2.caption: = 'hide all '; button3.caption: = 'unhide'; button2.enabled: = false; button3.enabled: = false;End; {Extract list}ProcedureTform1.button1click (Sender: tobject );VaRH: hwnd; count, size, num: Cardinal; PID, pH: Cardinal; P: pointer; icobtn: ttbbutton; Buf:Array[0 .. 255]OfWidechar; I: integer; item: tlistitem;BeginH: = trayhwnd; count: = sendmessage (H, tb_buttoncount, 0, 0); Size: = sizeof (ttbbutton); getwindowthreadprocessid (H, pid); Ph: = OpenProcess (process_vm_read, false, pid );ForI: = 0ToCount-1DoBeginSendmessage (H, tb_getbutton, I, DWORD (p); readprocessmemory (pH, P, @ icobtn, size, num); readprocessmemory (pH, pointer (icobtn. istring), @ Buf, length (BUF) * sizeof (BUF [0]), num); item: = listview1.items. add; item. caption: = Buf;End; Closehandle (ph); button2.enabled: = true; button3.enabled: = true;End; {Hide all}ProcedureTform1.button2click (Sender: tobject );VaRH: hwnd; count, I: Cardinal;BeginH: = trayhwnd; count: = sendmessage (H, tb_buttoncount, 0, 0 );ForI: = 0ToCount-1DoSendmessage (H, tb_hidebutton, I, 1 );End; {Show all}ProcedureTform1.button3click (Sender: tobject );VaRH: hwnd; count, I: Cardinal;BeginH: = trayhwnd; count: = sendmessage (H, tb_buttoncount, 0, 0 );ForI: = 0ToCount-1DoSendmessage (H, tb_hidebutton, I, 0 );End;End.