一個小小的Delphi時間控制示例,獲取系統時間,費話不多說了,看運行截圖吧:
具體代碼如下:
01
unit
Unit1;
02
interface
03
uses
04
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
05
StdCtrls;
06
type
07
TForm1 =
class
(TForm)
08
Button1: TButton;
09
Memo1: TMemo;
10
Button2: TButton;
11
procedure
Button1Click(Sender: TObject);
12
FormCreate(Sender: TObject);
13
Button2Click(Sender: TObject);
14
private
15
{ Private declarations }
16
public
17
{ Public declarations }
18
end
;
19
var
20
Form1: TForm1;
21
implementation
22
{$R *.DFM}
23
ShellAPI;
24
function
SetSystemDateTime(Year, Month, Day, Hour, Minute, Second:
Word
):
integer
; export;
25
SetDate(Year, Month, Day:
); assembler;
26
asm
27
MOV CX,Year
28
MOV DH,
BYTE
PTR Month
29
MOV DL,
PTR Day
30
MOV AH,2BH
31
INT 21H
32
33
SetTime(Hour, Minute, Second, Sec100:
34
35
MOV CH,
PTR Hour
36
MOV CL,
PTR Minute
37
PTR Second
38
PTR Sec100
39
MOV AH,2DH
40
41
42
begin
43
SetDate(Year, Month, Day);
44
SetTime(Hour, Minute +
1
, Second,
0
);
45
result :=
46
47
TForm1
.
48
49
st : TSYSTEMTIME;
50
51
//得到系統時間
52
GetSystemTime(st);
53
//顯示系統時間
54
Memo1
Lines
Add(
'系統時間 = '
+
55
IntToStr(st
wmonth) +
'/'
56
wDay) +
57
wYear) +
' '
58
wHour) +
':'
59
wMinute) +
60
wSecond));
61
62
63
64
Clear;
65
66
67
68
st: TSYSTEMTIME;
69
70
DateTimeToSystemTime(StrToDatetime(
'2002-06-23 15:39:46'
),st);
71
SetSystemTime(st);
72
73
這些功能或者可以用來證明作為移交的一部分的軟件的質量,也因
4. 編碼下面我們要完成的就是界面設計、編碼工作。在工程視
TGPLinearGradientBrush.
本例效果圖:代碼文件:unit Unit1;i
[教學] Log.d 日志調試查看(所有平台),log.d日