Chinaunix首页 | 论坛 | 博客
  • 博客访问: 623325
  • 博文数量: 262
  • 博客积分: 8433
  • 博客等级: 中将
  • 技术积分: 2141
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-31 09:37
文章分类

全部博文(262)

文章存档

2012年(1)

2011年(168)

2010年(92)

2009年(1)

分类: 嵌入式

2011-04-29 14:46:19

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
 
 
 
 
 
 
Hope this help Anthony.
////**********************************************************************************************************************************************************

汉语白话就是

   void 你的Ctrl::DoPropExchange(CPropExchange* pPX)
   {
         ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor));
         COleControl::DoPropExchange(pPX);                                          
        PX_String(pPX,_T("myproperty"),m_property); //就加上这一行,m_property是你要绑定的变量,其它行都是MFC自动生成的
   }

 

阅读(923) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~