unit ActiveDs;
interface
function ADsGetObject(const PathName: WideString; const GUID: TGUID;
out I: IUnknown): HRESULT;
stdcall;
implementation
function ADsGetObject;
external
end;
方法一(參照C++)
var
I: IADsContainer;
ADs: IADs;
begin
if ADsGetObject(
begin
ADs := IADs(I
ShowMessage(ADs
if ADs
begin
ADs := IADs(I
ShowMessage(ADs
if ADs
begin
ADs := IADs(I
ADs
ADs
ADs
end;
end;
end;
end;
方法二(使用接口)
procedure TForm
var
Disp: IDispatch;
begin
Disp := IISNamespace
Disp := (Disp as IADsContainer)
Disp := (Disp as IADsContainer)
Disp := (Disp as IADsContainer)
(Disp as IADs)
(Disp as IADs)
(Disp as IADs)
end;
方法三(使用Variant
procedure TForm
var
WebSite
begin
WebSite := CreateOleObject(
WebSite := WebSite
WebServer := WebSite
WebRoot := WebServer
VDir := WebRoot
VDir
VDir
VDir
end;
From:http://tw.wingwit.com/Article/program/Delphi/201311/25081.html