ISAPI方式的服務器端程序
我用DELPHI
重點
typedef struct _WIN
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved
DWORD dwReserved
TCHAR cFileName
[ MAX_PATH ];
TCHAR cAlternateFileName[
} WIN
程序的action內容
name
pathinfo
enabled
updata
WebActionItem
/DispNews true
源代碼如下
unit Unit
interface
uses
Windows
SysUtils
HTTPApp
type
TWebModule
Timer
procedure WebModule
(Sender: TObject; Request: TWebRequest;
Response: TWebResponse;
var Handled: Boolean);
procedure WebModule
Action(Sender: TObject;
Request: TWebRequest; Response:
TWebResponse; var Handled: Boolean);
procedure Timer
private
{ Private declarations }
public
{ Public declarations }
end;
var
WebModule
implementation
{$R *
//
//本部分是執行不帶入口的dll
//主要目的是下拉菜單的時間動態改變
procedure TWebModule
WebModule
(Sender: TObject;
Request: TWebRequest;
Response: TWebResponse;
var Handled: Boolean);
var DHTML:string;
var I:integer;
begin
DHTML:=
DHTML:=DHTML+
DHTML:=DHTML+
新聞中心< /title >
DHTML:=DHTML+
DHTML:=DHTML+
DHTML:=DHTML+
請選擇日期
DHTML:=DHTML+
method=
DHTML:=DHTML+
< select size=
//下拉列表中包含
前推十天的日期
DHTML:=DHTML+
selected value=
date)+
DHTML:=DHTML+
+FormatDateTime(
>昨天< /option >
DHTML:=DHTML+
+FormatDateTime(
>前天< /option>
for i:=
DHTML:=DHTML+
+FormatDateTime(
date
(
DHTML:=DHTML+
< input type=
DHTML:=DHTML+
DHTML:=DHTML+
DHTML:=DHTML+
DHTML:=DHTML+
Response
end;
//根據request傳送的參數 確定要顯示的文件目錄
//並從該目錄中取出所有的htm文件
//如果沒有該目錄
procedure TWebModule
WebModule
Item
Request: TWebRequest;
Response: TWebResponse;
var Handled: Boolean);
Var ReqDir:Tstrings;
//保存Request要求的參數
Var DHTML
var FileNameData:
WIN
var SearchFileHandle:THandle;
begin
ReqDir:=NIL;
ReqDir:=Request
ContentFields;
DHTML:=
DHTML:=DHTML+
DHTML:=DHTML+
< title >新聞中心< /title >
DHTML:=DHTML+
< /head >
DHTML:=DHTML+
< body >
DHTML:=DHTML+
< p align=
< font face=
color=
新聞中心< /font >< /p >
//DHTML:=DHTML
+ReqDir
SeleDir:=ReqDir
Values[
// 獲得搜索句柄
SearchFileHandle:=FindFirstFile
(Pchar(
\*
if SearchFileHandle< >
INVALID_HANDLE_VALUE then
begin
DHTML:=DHTML+
href=
+FileNameData
+FileNameData
< /a >< /p >
//根據搜索句柄向後搜索
while FindNextFile
(SearchFileHandle
FileNameData ) do
DHTML:=DHTML+
href=
+FileNameData
>
< /a >< /p >
//關閉搜索句柄
fileClose(SearchFileHandle);
end
else
DHTML:=DHTML+
DHTML:=DHTML+
DHTML:=DHTML+
Response
end;
//在上午八點到九點之間
Timer被激發一次
procedure TWebModule
Timer
begin
if FormatDateTime(
time)=
mkdir(IntToStr(StrToInt
(FormatDateTime(
end;
end;
實際使用時
From:http://tw.wingwit.com/Article/program/Delphi/201311/8517.html