delphi 在桌面左上角显示时间

{在左上角显示时间}
procedure ThreadProc;
var
  hScreenDC: hdc;
  SystemTime: _SYSTEMTIME;
  Temp: string;
  MyOutput: PChar;
begin
  while true do
  begin
    Sleep(100);
    hScreenDC := GetDC(0);
    GetLocalTime(SystemTime);
    Temp := format('Current Time is %d-%d-%d %d:%d:%d', [SystemTime.wYear,
      SystemTime.wMonth,
        SystemTime.wDay,
        SystemTime.wHour,
        SystemTime.wMinute,
        SystemTime.wSecond]);
    MyOutPut := Pchar(temp);
    TextOut(hScreenDC, 0, 0, MyOutPut, lstrlen(MyOutPut));
    ReleaseDC(0, hScreenDC);
  end;
end;
posted @ 2012-06-02 21:33  wouldguan  阅读(314)  评论(0编辑  收藏  举报