home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2002 February
/
Chip_2002-02_cd1.bin
/
zkuste
/
delphi
/
kolekce
/
d45
/
delfi_components.exe
/
Delfi_setdatetime.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
2001-11-20
|
2KB
|
68 lines
// unit Delfi_setdatetime
//
// component that can set system date and time . I seen component like this
// but it was only dcu for D3 so i needed to make my own that vorks in D4 !
//
// version 1.0 2001 Delfi
//
// this component is freeware for non-commercial applications you use it on your own responsibility !
// you may modify this unit only for non-commercial applications
// you may not change the AUTHOR you must leave this comment here !
//
// if you improved this component add your comment after this line
unit Delfi_setdatetime;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TDelfi_setdatetime = class(TComponent)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
procedure settime(h,m,s,ms: byte);
procedure SetDate(y:word; m,d: byte);
published
{ Published declarations }
end;
procedure Register;
implementation
// simple ? i needed 2 years to write these 9 lines of code for each function !!!
procedure TDelfi_setdatetime.SetDate(y:word; m,d: byte);
var systime : TSystemTime;
begin
GetLocalTime(systime);
systime.wday := d;
systime.wmonth := m;
systime.wyear := y;
SetLocalTime(systime);
end;
procedure TDelfi_setdatetime.SetTime(h,m,s,ms: byte);
var systime : TSystemTime;
begin
GetLocalTime(systime);
systime.whour := h;
systime.wminute := m;
systime.wsecond := s;
systime.wmilliseconds := ms;
SetLocalTime(systime);
end;
procedure Register;
begin
RegisterComponents('Delfi', [TDelfi_setdatetime]);
end;
end.