delphi 下的日期计算
在项目中,需要做一个日期的提醒功能,挺郁闷的,对日期的计算:
很幸运的是在delphi 中有现有的计算函数,DateUtils单元;
路径:*\Delphi7\Source\Rtl\Common 目录下。
贴出一部分:
function IncYear(const AValue: TDateTime;
const ANumberOfYears: Integer = 1): TDateTime;
// function IncMonth is in SysUtils
function IncWeek(const AValue: TDateTime;
const ANumberOfWeeks: Integer = 1): TDateTime;
function IncDay(const AValue: TDateTime;
const ANumberOfDays: Integer = 1): TDateTime;
function IncHour(const AValue: TDateTime;
const ANumberOfHours: Int64 = 1): TDateTime;
function IncMinute(const AValue: TDateTime;
const ANumberOfMinutes: Int64 = 1): TDateTime;
function IncSecond(const AValue: TDateTime;
const ANumberOfSeconds: Int64 = 1): TDateTime;
function IncMilliSecond(const AValue: TDateTime;
const ANumberOfMilliSeconds: Int64 = 1): TDateTime;
参考地址:http://info.52z.com/html/24801.html
相关文档:
<1>利用Unit的
Initalization与Finalization这两个小节
可以在Unit的这两个小节中安排Unit的进入和退出,但是
Program
与
Library并没有这两个部分,所以只能写在Unit中。
<2>利用ExitProc变量
在Library的begin
..end.中间是可以写代码
的,
这里可以放置
DLL初始化代码
。如果想要做善 ......
Delphi编写系统服务三:编写两栖系统服务 收藏
采用下面的方法,可以实现一个两栖系统服务(既系统服务和桌面程序的两种模式)
工程代码:
program FleetReportSvr;
uses
SvcMgr,
Forms,
SysUtils,
Windows,
SvrMain in 'SvrMain.pas' {FleetReportService: TService}, ......
比如操作
CSDN的登录
先用WebBrowser定位到登录页面
WebBrowser1.Navigate('http://passport.csdn.net/UserLogin.aspx?from=http://community.csdn.net/');
然后,看其HTML源代码,发现
名字为 ctl00$CPH_Content$tb_LoginNameOrLoginEmail的元素就是 其用户名的输入框了。
此时
使用
(WebBrowser1.Documen ......
procedure Delay(msecs:integer);
var
Tick: DWord;
Event: THandle;
begin
Event := CreateEvent(nil, False, False, nil);
try
Tick := GetTickCount + DWord(msecs);
while (msecs > 0) and (MsgWaitForMultipleObjects(1, Event, False, msecs, QS_ALLINPUT) <&g ......