获取HTML参数需要实现 IPersistPropertyBag 接口
...
TActiveTest = class(TActiveForm, IActiveTest, IPersistPropertyBag)
// 加入IPersistPropertyBag接口
...
private
...
{ IPersistPropertyBag }
function IPersistPropertyBag.InitNew = PersistPropertyBagInitNew;
function IPersistPropertyBag.Load = PersistPropertyBagLoad;
function IPersistPropertyBag.Save = PersistPropertyBagSave;
function PersistPropertyBagLoad(const pPropBag: IPropertyBag
const pErrorLog: IErrorLog): HResult
stdcall;
function PersistPropertyBagSave(const pPropBag: IPropertyBag
fClearDirty: BOOL
fSaveAllProperties: BOOL): HResult
stdcall;
function PersistPropertyBagInitNew: HResult
stdcall;
function GetClassID(out classID: TCLSID): HResult
stdcall;
...
implementation
...
function TActiveTest.GetClassID(out classID: TCLSID): HResult;
begin
Result := S_OK;
end;
function TActiveTest.PersistPropertyBagInitNew: HResult;
begin
Result := S_OK;
end;
function TActiveTest.PersistPropertyBagSave(const pPropBag: IPropertyBag;
fClearDirty, fSaveAllProperties: BOOL): HResult;
begin
Result := S_OK;
end;
function TActiveTest.PersistPropertyBagLoad(const pPropBag: IPropertyBag;
const pErrorLog: IErrorLog): HResult;
var
v: OleVariant;
begin
if pPropBag.Read( 'name', v, pErrorLog) = S_OK then
ShowMessage('Get name parameter is ' + v);
Result := S_OK;
end;
// 读入HTML name参数,并显示
....
HTML 如下所示
<HTML>
<H1> Delphi 6 ActiveX Test Page </H1><p>
You should see your Delphi 6 forms or controls embedded in the form below.
<HR><center><P>
<OBJECT
classid="clsid:AF10804E-A44A-4174-AD09-B23892AE39FD"
codebase="http://DragonPC/cgi-bin/ActiveTestProj1.ocx#version=1,0,0,0"
width=314
height=74
align=center
hspace=0
vspace=0
>
<PARAM name="name" value="[come on baby, get name parameter]">
</OBJECT>
</HTML>