章
章慧
Unregistered / Unconfirmed
GUEST, unregistred user!
1。我想建立一个对象来读写本地文件。
于是建立一个VDSDriver的ActiveX Library.
Library VDSDriver;
uses
ComServ,
VDSDriver_TLB in 'VDSDriver_TLB.pas',
Process in 'Process.Pas' {VDSDiskDriver: CoClass};
Exports
DllGetClassObject,
DllCanUnloadNow,
DllRegisterServer,
DllUnregisterServer;
{$R *.TLB}
{$R *.RES}
Begin
End.
然后用向导添加一个AUTOMATION OBJECT和一个GetInfo方法
unit Process;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
ComObj, ActiveX, VDSDriver_TLB, StdVcl, Dialogs;
type
TVDSDiskDriver = class(TAutoObject, IVDSDiskDriver)
protected
procedure GetInfo(out Info: OleVariant); safecall;
{ Protected declarations }
end;
implementation
uses ComServ;
procedure TVDSDiskDriver.GetInfo(out Info: OleVariant);
begin
ShowMessage('Ok');
Info:='bakayarou!';
end;
initialization
TAutoObjectFactory.Create(ComServer, TVDSDiskDriver, Class_VDSDiskDriver,
ciMultiInstance, tmApartment);
end.
编译。注册。
然后浏览这个页面
<script language=vbscript>
On Error Resume Next
set kao=CreateObject("VDSDriver.VDSDiskDriver")
if err<>0 then
MsgBox("kao not properly installed)
else
call kao.GetInfo(info)
MsgBox(info)
end if
</script>
为什么IE说“ActiveX交互不安全”?能有解决的办法吗?
还有,为什么用同样的方法,创建COM OBJECT的话,不能正确运行呢?
有什么办法能运行呢?
急!
于是建立一个VDSDriver的ActiveX Library.
Library VDSDriver;
uses
ComServ,
VDSDriver_TLB in 'VDSDriver_TLB.pas',
Process in 'Process.Pas' {VDSDiskDriver: CoClass};
Exports
DllGetClassObject,
DllCanUnloadNow,
DllRegisterServer,
DllUnregisterServer;
{$R *.TLB}
{$R *.RES}
Begin
End.
然后用向导添加一个AUTOMATION OBJECT和一个GetInfo方法
unit Process;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
ComObj, ActiveX, VDSDriver_TLB, StdVcl, Dialogs;
type
TVDSDiskDriver = class(TAutoObject, IVDSDiskDriver)
protected
procedure GetInfo(out Info: OleVariant); safecall;
{ Protected declarations }
end;
implementation
uses ComServ;
procedure TVDSDiskDriver.GetInfo(out Info: OleVariant);
begin
ShowMessage('Ok');
Info:='bakayarou!';
end;
initialization
TAutoObjectFactory.Create(ComServer, TVDSDiskDriver, Class_VDSDiskDriver,
ciMultiInstance, tmApartment);
end.
编译。注册。
然后浏览这个页面
<script language=vbscript>
On Error Resume Next
set kao=CreateObject("VDSDriver.VDSDiskDriver")
if err<>0 then
MsgBox("kao not properly installed)
else
call kao.GetInfo(info)
MsgBox(info)
end if
</script>
为什么IE说“ActiveX交互不安全”?能有解决的办法吗?
还有,为什么用同样的方法,创建COM OBJECT的话,不能正确运行呢?
有什么办法能运行呢?
急!