CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
花落谁家,你作主! 盛大widget设计大赛英雄榜
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  ATL/ActiveX/COM

vc写的activex怎样得到html传递过来得参数??

楼主hjt79()2003-10-01 11:37:30 在 VC/MFC / ATL/ActiveX/COM 提问

我在html写的代码如下:  
  <html>  
      <head>  
      <title>DialogControl</title>  
      </head>  
      <body>  
       
      <center>  
      <OBJECT   ID="VideoClient"     CLASSID="CLSID:EA5E6EA1-1F28-4032-A513-6A3A6431F5C3"  
  CODEBASE="VideoClient.ocx"  
        HEIGHT=800   WIDTH=1000>  
      <param   name="m_ip"   value="192.168.1.13">  
      </OBJECT>  
      </center>  
       
      </body>  
      </html>  
   
   
  我问的是在activex怎样写代码得到html代码传递过来的m_ip的值,多谢指教!!  
  另外我的activex是用vc写的 问题点数:20、回复次数:3Top

1 楼Onega(www.fruitfruit.com)回复于 2003-10-01 19:50:25 得分 20

short   answer:   implement   IPersistPropertyBag   interface,   long   answer   is   given   by   others  
   
  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

2 楼plane1980(fy)回复于 2003-10-01 20:46:38 得分 0

用定义一个接口Top

3 楼hjt79()回复于 2003-10-02 02:30:57 得分 0

我的问题解决了,太好了,很感谢Onega()的帮助,谢谢!!Top

相关问题

  • vc里的参数this是什么意思?
  • vc中用数组名做参数
  • 关于Activex传递参数的问题
  • 如何得到html中的参数?
  • 请教关于HTML带参数问题......
  • javascript加html的参数传递问题
  • 用VC怎么给Vb做 字符串参数 的dll??
  • 怎么用Vc给VB做 字符串参数的函数?
  • ~~~~~~~~~~~~~请问在VC中 怎么取得命令行的参数?
  • 为什么我的VC不能动态提示参数表了?

关键词

得分解答快速导航

  • 帖主:hjt79
  • Onega

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo