Mega Code Archive

 
Categories / Delphi / Examples
 

System tray

uses ShellApi; var Form1: TForm1; tray:pNOTIFYICONDATAa; implementation uses Unit2; {$R *.DFM} procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); begin Shell_NotifyIcon(2,tray); FreeMem(tray); end; procedure gizle; begin form1.visible:=false; end; procedure TForm1.RadioButton4Click(Sender: TObject); var tray:pNOTIFYICONDATAa; begin Shell_NotifyIcon(2,tray) end; procedure TForm1.FormCreate(Sender: TObject); begin getmem(tray,500); tray.cbSize:=tray.cbSize; tray.uCallbackMessage:=$200; tray.szTip:='Abdullah YÖN'; tray.Wnd:=Handle; tray.uFlags:=7; tray.uID:=7; tray.hIcon:=icon.handle; Shell_NotifyIcon(0,tray); end; procedure TForm1.A1Click(Sender: TObject); begin form1.Visible:=true; TrayKapat1.Enabled:=true; kapat1.Enabled:=true; end; procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var a,b:integer; begin // $201 sol tuş basıldı // $202 sol tuş bırakılsı // $203 çift tıklandı // $204 sağ tuş basıldı // $205 sağ tuş bırakıldı // $206 sağ tuş çift tıklandı if x=$203 then form2.show; if x=$205 then begin a:=mouse.CursorPos.x; b:=mouse.CursorPos.y; form1.PopupMenu1.Popup(a,b); end; end; end.