一个网页控件参数问题
ALT编的一个控件,有一个属性Count。插入网页,代码为
<object classid="clsid:709DF088-BABF-4E2F-9E9C-593D090CE16C" width="800" height="600">
<param name="Count" value="5">
</object>
可是Param竟然没有作用! 请高手说说Param的原理。
问题点数:100、回复次数:10Top
1 楼masterz(www.fruitfruit.com)回复于 2002-08-23 17:46:44 得分 95
implement IPersistPropertyBag interfaceTop
2 楼masterz(www.fruitfruit.com)回复于 2002-08-23 17:48:29 得分 0
A post found in newsgroup
==============================================================
I've been spending some time trying to figure out
how to code the "get custom property" from the value that
I put in the PARAM tag in my HTML page.
In fact it's really easy, the problem is that it was difficult to find
a easy sample talking about MFC implementation and not ATL.
SO...
1. Create you OLE Control using Active X wizard
2. Add a property using the GET/SET or the GlobalVariable
3. if on step 2 you created using the GET/SET , add a global variable
on your myolecontrolctl.cpp for example m_property
4. Modify by hand the PropExchange method of your control
using the PX_String, PX_Short, PX_....
depending of the type of variable you're using
you'll add the following
if your variable is a CString
void CActiveAdvCtrl::DoPropExchange(CPropExchange* pPX)
{
ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor));
COleControl::DoPropExchange(pPX);
if (pPX->GetVersion() == (DWORD)MAKELONG(_wVerMinor, _wVerMajor))
{
PX_String(pPX,_T("myproperty"),m_property);
PX_String(pPX,_T("myproperty1"),m_property1);
}
}
where m_property is the variable and myproperty is the external name you gave
when you created the property.
So when calling the page from the browser, the PARAM will be loaded
to the different variables
<OBJECT CLASSID="clsid:1AEDB630-4A08-4C22-BC74-0629C264B2CA"
ALIGN="CENTER" WIDTH=100 HEIGHT=100 ID="DActiveX1">
<PARAM NAME="myproperty" VALUE="123">
<PARAM NAME="myproperty1" VALUE="555">
<PARAM NAME="Enabled" VALUE=1>
<PARAM NAME="_ExtentX" VALUE="0">
<PARAM NAME="_ExtentY" VALUE="0">
</OBJECT>
Hope this help
Anthony.
"Alexander Nickolov" <agnickolov@geocities.com> wrote in message news:<#4Ma63wmBHA.2084@tkmsftngp04>...
> Did you implement IPersistPropertyBag on your control?
> ============
> Alexander Nickolov
> Microsoft MVP [VC], MCSD
> email: agnickolov@geocities.com
> MVP VC FAQ: http://www.mvps.org/vcfaq
> =========================
> ============
>
> "Anthony" <anthonyg@passinglane.com> wrote in message
> news:cff4bb7e.0201111456.7b620a25@posting.google.com...
> > Hi Everyone,
> >
> > I created an active X in VC6
> > Everything seems to work perfectly if I call my methods and properties
> > from a javascript.
> > BUT what ever I put in the PARAM tag are not initialized
> > my properties Get/Set are not called.. !
> >
> > Any idea or anything I'm doing wrong?
> >
> > Thanks for your help.
Top
3 楼bojinyu(沙鱼)回复于 2002-08-26 09:45:51 得分 0
用ATL我实现不了啊,哪里有例子让我看看?Top
4 楼masterz(www.fruitfruit.com)回复于 2002-08-26 09:50:15 得分 0
http://search.microsoft.com/gomsuri.asp?n=1&c=rp_Results&siteid=us&target=http://support.microsoft.com/support/kb/articles/Q197/9/21.aspTop
5 楼bojinyu(沙鱼)回复于 2002-08-26 10:17:15 得分 0
Thank you masterzTop
6 楼bojinyu(沙鱼)回复于 2002-08-26 11:08:14 得分 0
哎,这个例子用IPersistPropertyBag实现,怎么没用IPersistPropertyBagImpl实现?Top
7 楼bojinyu(沙鱼)回复于 2002-08-26 11:20:00 得分 0
有点看不懂,有没有更详细的介绍?Top
8 楼liuns(^_^)回复于 2002-08-26 11:59:41 得分 5
masterz() si illustrate very clearlyTop
9 楼bojinyu(沙鱼)回复于 2002-08-26 13:57:04 得分 0
奈何一纸之遥?Top
10 楼bojinyu(沙鱼)回复于 2002-08-26 14:44:31 得分 0
哈哈哈,我找到解决的好例子了,共享共享:http://www.devx.com/upload/free/features/vcdj/2000/12dec00/ac0012/ac0012.aspTop
相关问题
- 请问网页上给控件传递参数的问题?
- 在网页中不能传参数给我的控件
- 在网页中,怎样为控件的属性赋参数?
- 如何将网页中参数传到ActiveX Form (ocx控件)?
- winform控件嵌入网页中参数传递的问题怎么解决
- 请问在mfc activex控件中怎么得到网页中的参数?
- 我用mfc写的ocx控件,为什么不能通过网页获得参数呢?
- cb写activex控件,在网页中如何接收form传的参数!!最好有源代码!!
- 我用mfc做一个控件XXX,准备在网页上调用,请问从网页如何传递参数给控件XXX呢?是通过控件属性吗?请问添加属性是在类CXXXCtrl中添加,
- 急急急!请各位帮个忙!从网页中给activex控件传参数不好用的问题,等着交活呢~~~解决了就加分!!!




