sylexer
asked on
ActiveX Param
Hi
Does anybody have a example program how to handle the <PARAM> strings in a html document with an activeForm in delphi
I want to read the folowing parameters :
<OBJECT
classid="clsid:B95A6EC2-C4 98-41CB-98 E6-5352161 D4A8E"
codebase="testing1234Proj1 .ocx"
width=333
height=347
align=center
hspace=0
vspace=0>
<param NAME="testpar1" VALUE="0">
<param NAME="testpar2" VALUE="http://www.test.com">
<param NAME="testpar3" VALUE="False">
<param NAME="testpar4" VALUE="True">
</OBJECT>
how can i fix this ???
Does anybody have a example program how to handle the <PARAM> strings in a html document with an activeForm in delphi
I want to read the folowing parameters :
<OBJECT
classid="clsid:B95A6EC2-C4
codebase="testing1234Proj1
width=333
height=347
align=center
hspace=0
vspace=0>
<param NAME="testpar1" VALUE="0">
<param NAME="testpar2" VALUE="http://www.test.com">
<param NAME="testpar3" VALUE="False">
<param NAME="testpar4" VALUE="True">
</OBJECT>
how can i fix this ???
ASKER
Could you be a little be more specific or send me an url where its exact explained.
Tnx man
Tnx man
ASKER
Well i tried a few things but no succes so far
in delphi the typelib added a few thingz
(in protected area)
function Get_Property1: WideString; safecall;
procedure Set_Property1(const Value: WideString); safecall;
(in implementation)
function TActiveFormX.Get_Property1 : WideString;
begin
//--- ??? what to put here
end;
procedure TActiveFormX.Set_Property1 (const Value: WideString);
begin
//--- ??? what to put here
end;
(in html i added this)
<OBJECT
classid="clsid:91C03AC5-9D 3A-449C-B8 78-D5B9528 4E93A"
codebase="./theocx.ocx#ver sion=1,0,0 ,0"
width=271
height=135
align=center
hspace=0
vspace=0
>
<PARAM name="Property1" value="1234567">
</OBJECT>
but no succes till now
i want the property1 value in an variable called propertyval1 for example :S
(yeah i am a newbe to this)
in delphi the typelib added a few thingz
(in protected area)
function Get_Property1: WideString; safecall;
procedure Set_Property1(const Value: WideString); safecall;
(in implementation)
function TActiveFormX.Get_Property1
begin
//--- ??? what to put here
end;
procedure TActiveFormX.Set_Property1
begin
//--- ??? what to put here
end;
(in html i added this)
<OBJECT
classid="clsid:91C03AC5-9D
codebase="./theocx.ocx#ver
width=271
height=135
align=center
hspace=0
vspace=0
>
<PARAM name="Property1" value="1234567">
</OBJECT>
but no succes till now
i want the property1 value in an variable called propertyval1 for example :S
(yeah i am a newbe to this)
ASKER
(It workx but not how it should be :( )
Hmmmzz i know now why the first time my vars where not
passed trough the first time
This is what i got now :
(html param)
<param name="Property1" value="1234567890 test">
(delphi)
var
property1var : string;
function TActiveFormX.Get_Property1 : WideString;
begin
Result := property1var;
end;
procedure TActiveFormX.Set_Property1 (const Value: WideString);
begin
property1var := Value;
end;
On the form oncreate event i do the next
label1.caption := property1var;
Now when the page loads the caption stays empty
BUT !!!! when i refresh the page the label gets its value
How is this fixable so he gets its params the first time the page loads
Hmmmzz i know now why the first time my vars where not
passed trough the first time
This is what i got now :
(html param)
<param name="Property1" value="1234567890 test">
(delphi)
var
property1var : string;
function TActiveFormX.Get_Property1
begin
Result := property1var;
end;
procedure TActiveFormX.Set_Property1
begin
property1var := Value;
end;
On the form oncreate event i do the next
label1.caption := property1var;
Now when the page loads the caption stays empty
BUT !!!! when i refresh the page the label gets its value
How is this fixable so he gets its params the first time the page loads
Add interface to IPersistPropertyBag, e.g.
TMyActiveForm = class(TActiveForm, IMyActiveForm, IPersistPropertyBag) <-- add this!
then implement all these as protected
function IPersistPropertyBag.Load = PersistPropertyBagLoad;
function IPersistPropertyBag.Save = PersistPropertyBagSave;
function IPersistPropertyBag.InitNe w = PersistPropertyBagInitNew;
function IPersistPropertyBag.GetCla ssID = PersistPropertyBagGetClass ID;
function PersistPropertyBagLoad(con st pPropBag: IPropertyBag;
const pErrorLog: IErrorLog): HResult; stdcall;
function PersistPropertyBagSave(con st pPropBag: IPropertyBag; fClearDirty: BOOL;
fSaveAllProperties: BOOL): HResult; stdcall;
function PersistPropertyBagGetClass ID(out classID: TCLSID): HResult; stdcall;
function PersistPropertyBagInitNew: HResult; stdcall;
... and the code
function TMyActiveForm.PersistPrope rtyBagLoad (
const pPropBag: IPropertyBag; const pErrorLog: IErrorLog): HResult;
var
v: OleVariant;
begin
Result := S_OK;
try
if pPropBag.Read('Property1', v, pErrorLog) = S_OK then
Caption := v;
except
end;
end;
function TMyActiveForm.PersistPrope rtyBagSave (
const pPropBag: IPropertyBag; fClearDirty,
fSaveAllProperties: BOOL): HResult;
begin
Result := S_OK;
end;
function TMyActiveForm.PersistPrope rtyBagGetC lassID(out classID: TCLSID): HResult;
begin
Result := S_OK;
end;
function TMyActiveForm.PersistPrope rtyBagInit New: HResult;
begin
Result := S_OK;
end;
HTH
DragonSlayer
TMyActiveForm = class(TActiveForm, IMyActiveForm, IPersistPropertyBag) <-- add this!
then implement all these as protected
function IPersistPropertyBag.Load = PersistPropertyBagLoad;
function IPersistPropertyBag.Save = PersistPropertyBagSave;
function IPersistPropertyBag.InitNe
function IPersistPropertyBag.GetCla
function PersistPropertyBagLoad(con
const pErrorLog: IErrorLog): HResult; stdcall;
function PersistPropertyBagSave(con
fSaveAllProperties: BOOL): HResult; stdcall;
function PersistPropertyBagGetClass
function PersistPropertyBagInitNew:
... and the code
function TMyActiveForm.PersistPrope
const pPropBag: IPropertyBag; const pErrorLog: IErrorLog): HResult;
var
v: OleVariant;
begin
Result := S_OK;
try
if pPropBag.Read('Property1',
Caption := v;
except
end;
end;
function TMyActiveForm.PersistPrope
const pPropBag: IPropertyBag; fClearDirty,
fSaveAllProperties: BOOL): HResult;
begin
Result := S_OK;
end;
function TMyActiveForm.PersistPrope
begin
Result := S_OK;
end;
function TMyActiveForm.PersistPrope
begin
Result := S_OK;
end;
HTH
DragonSlayer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
all properties must be of type WideString (BSTR in type library definition)
wbr, mo.