J
jianguobu
Unregistered / Unconfirmed
GUEST, unregistred user!
-----ActivexX Library
library DnsControl;
{%File 'DnsControl.asp'}
{%File 'Dns.asp'}
uses
ComServ,
DnsControl_TLB in 'DnsControl_TLB.pas',
Unit_Dns in 'Unit_Dns.pas' {Dns: CoClass};
exports
DllGetClassObject,
DllCanUnloadNow,
DllRegisterServer,
DllUnregisterServer;
{$R *.TLB}
{$R *.RES}
begin
end.
--------Active Server Object
unit Unit_Dns;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
ComObj, ActiveX, AspTlb, DnsControl_TLB, StdVcl, Windows, ShellApi, SysUtils, WinSock;
const
FileName='Error.txt';
type
TDns = class(TASPObject, IDns)
private
function GetLocalName: String;
protected
procedure OnEndPage
safecall;
procedure OnStartPage(const AScriptingContext: IUnknown)
safecall;
procedure ZoneAdd(DomainName: OleVariant)
safecall;
procedure ZoneDelete(DomainName: OleVariant)
safecall;
end;
implementation
uses ComServ;
procedure SaveInfo(FileName,str: string)
stdcall;
var
f: textfile;
begin
{保存为文件信息}
assignfile(f, FileName);
if fileexists(FileName) = false then rewrite(f)
else append(f);
if strcomp(pchar(str), pchar('#13#10')) = 0 then writeln(f, '')
else writeln(f, str);
closefile(f);
end;
function TDns.GetLocalName: String;
var
ComputerName: array[0..MAX_COMPUTERNAME_LENGTH+1] of char;
Size: Dword;
begin
Size := MAX_COMPUTERNAME_LENGTH+1;
if GetComputerName(ComputerName, Size) then
result:=StrPas(Computername)
else result:='Unkown';
end;
procedure TDns.OnEndPage;
begin
inherited OnEndPage;
end;
procedure TDns.OnStartPage(const AScriptingContext: IUnknown);
begin
inherited OnStartPage(AScriptingContext);
end;
procedure TDns.ZoneAdd(DomainName: OleVariant);
var
Str : String;
begin
Str := '/K d:/autodns/dnscmd '+Trim(GetLocalName)+' /ZoneAdd '+ DomainName + ' /Primary';
SaveInfo(FileName,DateTimeToStr(Now)+' 在做站点时生成的语句:'+Str);
ShellExecute(0,'open','cmd.exe',pchar('/K d:/autodns/dnscmd CXDNNET /ZoneAdd abc.com /Primary'),nil,SW_SHOWNORMAL);//测试用
// ShellExecute(0,'open','cmd.exe',pchar(str),nil,SW_SHOWNORMAL);
end;
procedure TDns.ZoneDelete(DomainName: OleVariant);
var
Str : String;
begin
Str := '/K d:/autodns/dnscmd '+Trim(GetLocalName)+' /ZoneDelete '+ DomainName + ' /f';
SaveInfo(FileName,DateTimeToStr(Now)+' 在做站点删除时生成的语句:'+Str);
ShellExecute(0,'open','cmd.exe',pchar(str),nil,SW_Hide );
end;
initialization
TAutoObjectFactory.Create(ComServer, TDns, Class_Dns,
ciMultiInstance, tmApartment);
end.
用asp调用不能在dns服务器里创建域名,在DNS服务器里不能看到有新建,而用
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, shellapi;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
ShellExecute(0,'open','cmd.exe',pchar('/K d:/autodns/dnscmd CXDNNET /ZoneAdd abc.com /Primary'),nil,SW_SHOWNORMAL);
end;
end.
能在dns服务器里创建域名,請问为什么?
library DnsControl;
{%File 'DnsControl.asp'}
{%File 'Dns.asp'}
uses
ComServ,
DnsControl_TLB in 'DnsControl_TLB.pas',
Unit_Dns in 'Unit_Dns.pas' {Dns: CoClass};
exports
DllGetClassObject,
DllCanUnloadNow,
DllRegisterServer,
DllUnregisterServer;
{$R *.TLB}
{$R *.RES}
begin
end.
--------Active Server Object
unit Unit_Dns;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
ComObj, ActiveX, AspTlb, DnsControl_TLB, StdVcl, Windows, ShellApi, SysUtils, WinSock;
const
FileName='Error.txt';
type
TDns = class(TASPObject, IDns)
private
function GetLocalName: String;
protected
procedure OnEndPage
safecall;
procedure OnStartPage(const AScriptingContext: IUnknown)
safecall;
procedure ZoneAdd(DomainName: OleVariant)
safecall;
procedure ZoneDelete(DomainName: OleVariant)
safecall;
end;
implementation
uses ComServ;
procedure SaveInfo(FileName,str: string)
stdcall;
var
f: textfile;
begin
{保存为文件信息}
assignfile(f, FileName);
if fileexists(FileName) = false then rewrite(f)
else append(f);
if strcomp(pchar(str), pchar('#13#10')) = 0 then writeln(f, '')
else writeln(f, str);
closefile(f);
end;
function TDns.GetLocalName: String;
var
ComputerName: array[0..MAX_COMPUTERNAME_LENGTH+1] of char;
Size: Dword;
begin
Size := MAX_COMPUTERNAME_LENGTH+1;
if GetComputerName(ComputerName, Size) then
result:=StrPas(Computername)
else result:='Unkown';
end;
procedure TDns.OnEndPage;
begin
inherited OnEndPage;
end;
procedure TDns.OnStartPage(const AScriptingContext: IUnknown);
begin
inherited OnStartPage(AScriptingContext);
end;
procedure TDns.ZoneAdd(DomainName: OleVariant);
var
Str : String;
begin
Str := '/K d:/autodns/dnscmd '+Trim(GetLocalName)+' /ZoneAdd '+ DomainName + ' /Primary';
SaveInfo(FileName,DateTimeToStr(Now)+' 在做站点时生成的语句:'+Str);
ShellExecute(0,'open','cmd.exe',pchar('/K d:/autodns/dnscmd CXDNNET /ZoneAdd abc.com /Primary'),nil,SW_SHOWNORMAL);//测试用
// ShellExecute(0,'open','cmd.exe',pchar(str),nil,SW_SHOWNORMAL);
end;
procedure TDns.ZoneDelete(DomainName: OleVariant);
var
Str : String;
begin
Str := '/K d:/autodns/dnscmd '+Trim(GetLocalName)+' /ZoneDelete '+ DomainName + ' /f';
SaveInfo(FileName,DateTimeToStr(Now)+' 在做站点删除时生成的语句:'+Str);
ShellExecute(0,'open','cmd.exe',pchar(str),nil,SW_Hide );
end;
initialization
TAutoObjectFactory.Create(ComServer, TDns, Class_Dns,
ciMultiInstance, tmApartment);
end.
用asp调用不能在dns服务器里创建域名,在DNS服务器里不能看到有新建,而用
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, shellapi;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
ShellExecute(0,'open','cmd.exe',pchar('/K d:/autodns/dnscmd CXDNNET /ZoneAdd abc.com /Primary'),nil,SW_SHOWNORMAL);
end;
end.
能在dns服务器里创建域名,請问为什么?