在ActiveForm上添加属性问题

jxk 2003-04-16 02:21:17
我在一个ActiveForm上添加了一个Conn属性
HRESULT _stdcall Conn([out, retval] BSTR * Value );
HRESULT _stdcall Conn([in] BSTR Value );

我在
function TActiveFormX.Get_Conn: WideString;
begin

end;
里面添加了 Result:=Conn;代码

可以编译得时候总是报
[Error] ActiveFormImpl1.pas(357): Undeclared identifier: 'Conn'
得错
请问怎么解决这个问题
...全文
80 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
jxk 2003-04-17
  • 打赏
  • 举报
回复
这是我最后用的方法

(转)我在Borland新闻组中找到如何使ActiveForm获取网页中参数的方法:

Hmmm. I followed an example from one of these newsgroups and got it w

orking

without a hitch. Did you declare support for IPersistPropertyBag in t

he

class definition?

Here is what mine looks like, with non-essentials removed:

class TMyActiveForm = class(TActiveForm, IMyActiveForm,

IPersistPropertyBag)

protected:

// IPersistPropertyBag

function IPersistPropertyBag.GetClassID = PersistPropertyBagGetCla

ssID;

function IPersistPropertyBag.InitNew = PersistPropertyBagInitNew;

function IPersistPropertyBag.Load = PersistPropertyBagLoad;

function IPersistPropertyBag.Save = PersistPropertyBagSave;

function PersistPropertyBagInitNew: HResult; stdcall;

function PersistPropertyBagGetClassID(out classID: TCLSID): HResul

t;

stdcall;

function PersistPropertyBagLoad(const pPropBag: IPropertyBag; cons

t

pErrorLog: IErrorLog): HResult; stdcall;

function PersistPropertyBagSave(const pPropBag: IPropertyBag;

fClearDirty: BOOL; fSaveAllProperties: BOOL): HResult; stdcall;

end;

implementation

(*

* IPersistPropertyBag

*)

function TMyActiveForm.PersistPropertyBagLoad(const pPropBag: IPropert

yBag;

const pErrorLog: IErrorLog): HResult;

var

v : OleVariant;

begin

if pPropBag.Read('ShowLegend', v, pErrorLog) = S_OK then

Set_ShowLegend( v );

if pPropBag.Read('XMLDSOID', v, pErrorLog) = S_OK then

Set_XMLDSOID( v );

result := S_OK;

end;

function TMyActiveForm..PersistPropertyBagSave(const pPropBag: IProper

tyBag;

fClearDirty, fSaveAllProperties: BOOL): HResult;

var

v : OleVariant;

begin

v := FShowLegend;

pPropBag.Write( 'ShowLegend', v );

v := FXMLDSOID;

pPropBag.Write( 'XMLDSOID', v );

result := S_OK;

end;

function TMyActiveForm..PersistPropertyBagGetClassID( out classID: TCL

SID):

HResult;

begin

try

classID := Class_MyActiveForm;

Result := S_OK;

except

end;

end;

function TMyActiveForm.PersistPropertyBagInitNew: HResult;

begin

try

result := S_OK;

except

end;

end;

lvloj 2003-04-16
  • 打赏
  • 举报
回复
var
Conn: WideString; //就定义在有以下代码的这个单元

function TActiveFormX.Get_Conn: WideString;//Get是网页Get,不是Delphi
begin
Result := Conn; //指网页的变量获得Conn的值
end;

function TActiveFormX.Set_Conn(Value: WideString);
begin
Conn := Value; //Value是网页传入的值.也就说Conn获得网页上变量的值
end;
jxk 2003-04-16
  • 打赏
  • 举报
回复
我试过把conn放到全局,可是用
<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:1B523C94-E81F-4A11-BB9A-AF22F72BFABD"
codebase="http://192.168.0.10:83/ActiveFormProj1.ocx#version=1,0,1,0"
width=512
height=330
align=center
hspace=0
vspace=0
<PARAM NAME="Conn" VALUE="aadgg">
>
</OBJECT>
</HTML>
调用这个activeform得时候得不到Conn得值啊
能不能发给我一个html传参数给ActiveForm得例子,多谢
我得邮箱是jiangxk@sina.com
bluebinbin 2003-04-16
  • 打赏
  • 举报
回复
上面Moj(Delphi fan)已经给出来了,我晚了,呵呵...

你注意一下,你需要返回的类型,它给的是"wideString".

再注意一下,全局变量.
jxk 2003-04-16
  • 打赏
  • 举报
回复
在哪里声明?
bluebinbin 2003-04-16
  • 打赏
  • 举报
回复
conn是什么?你的这个conn就是没有声明么,你声明一下就好.你疏忽了.
lvloj 2003-04-16
  • 打赏
  • 举报
回复
kyo1979 (绝望的生鱼片) : 你的理解可能有点错误,属性只是添加了一个接口.
请在ActiveForm的哪个单元定义变量
var
Conn: WideString;
jxk 2003-04-16
  • 打赏
  • 举报
回复
怎么没有人告诉我啊?
jxk 2003-04-16
  • 打赏
  • 举报
回复
可是编译得时候Result:=Conn总是报
[Error] ActiveFormImpl1.pas(357): Undeclared identifier: 'Conn'
得错
请问怎么解决这个问题

5,392

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧