这是我写的替换系统时间显示的代码,改一下就可以用来隐藏图标区。试试吧!
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Panel1: TPanel;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
t:SYSTEMTIME;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
th:hwnd;
r:trect;
dc:hdc;
begin
th:=FindWindowEx(FindWindowEx(FindWindow('Shell_TrayWnd',nil),0,'TrayNotifyWnd',nil),0,'TrayClockWClass',nil);
getwindowrect(th,r);
windows.setparent(panel1.Handle,th);
MoveWindow(panel1.Handle,0,0,r.Right-r.Left,r.Bottom-r.Top,true);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
getlocaltime(t);
panel1.Caption:='My '+inttostr(t.wHour)+':'+inttostr(t.wMinute);
// panel1.Hint:=inttostr(t.wYear)+'年'+inttostr(t.wMonth)+'月'+inttostr(t.wDay)+'日';
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
getlocaltime(t);
panel1.Caption:=inttostr(t.wHour)+':'+inttostr(t.wMinute);
// panel1.Hint:=inttostr(t.wYear)+'年'+inttostr(t.wMonth)+'月'+inttostr(t.wDay)+'日';
end;
end.