• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号
您的位置:首页 > 程序设计 >vc/mfc > 如何调用函数弹出ACTIVEX控件的属性对话框?[求助]

如何调用函数弹出ACTIVEX控件的属性对话框?[求助]

作者:佚名 字体:[增加 减小] 来源:互联网 时间:2017-06-04

佚名通过本文主要向大家介绍了activex控件下载xp,activex控件下载,activex控件,activex控件被阻止,activex控件官方下载等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: 如何调用函数弹出ACTIVEX控件的属性对话框?[求助]
描述:

我想调用函数弹出一个ACTIVEX控件的对话框
Active X Test Container可以,不知它是如何做的?


解决方案1:

http://www.codeguru.com/Cpp/COM-Tech/activex/controls/article.php/c2649/
Case 1: Your container wants to display property sheet of your control in runtime mode.
Actually, as I said before, this is documented in "Inside OLE" of Brockschmidt (pp795+.) Unfortunately, Brockschmidt assumes that you create your OLE control from scratch without COleControl class. If you have already derived your control from COleControl class (as you normally do), you already have a train of interfaces which you can see in OLE Object Viewer. In this case the following steps demonstrate how to display the property pages in runtime mode in your container.
Add GetPages() method to the implementation file of your control this way:
// This method returns array of property pages used then by
// OLE container to bring property pages to the user
STDMETHODIMP CDoSomethingCtrl::"#630000">XSpecifyPropertyPages::GetPages(CAUUID *pPages)
{
    GUID *pGUID;
    const unsigned CPROPPAGES = 4;
        
    pPages->cElems = 0;
    pPages->pElems = NULL;
 
    pGUID = (GUID*) CoTaskMemAlloc( CPROPPAGES * sizeof(GUID) );
    if( NULL == pGUID )
    {
        return ResultFromScode(E_OUTOFMEMORY);
    }
    // Fill the array of property pages now
    pGUID[0] = COptionsPropPage::guid;
    pGUID[2] = CLSID_CFontPropPage;
    pGUID[3] = CLSID_CColorPropPage;
    pGUID[4] = CLSID_CPicturePropPage;
    //Fill the structure and return
    pPages->cElems = CPROPPAGES;
    pPages->pElems = pGUID;
    return NOERROR;
}
Pay attention to this strange class XSpecifyPropertyPages: there is no place to declare this. Where does it come from? From COleControl, of course. Declaration of COleControl class includes the following lines:
// ISpecifyPropertyPages
BEGIN_INTERFACE_PART(SpecifyPropertyPages, ISpecifyPropertyPages)
    INIT_INTERFACE_PART(COleControl, SpecifyPropertyPages)
    STDMETHOD(GetPages)(CAUUID*);
END_INTERFACE_PART(SpecifyPropertyPages)
        where BEGIN_INTERFACE_PART is further decoded to
        #define BEGIN_INTERFACE_PART(localClass, baseClass) \
    class X##localClass : public baseClass \
    { \
    public: \
        STDMETHOD_(ULONG, AddRef)(); \ and so on
This is where XSpecifyPropertyPages comes from.
Add OnShowProperties method to the implementation file of your container (this is taken as is from the Inside OLE of BrockSchmidt with a note below):
void CApp::OnShowProperties(void)
{
    ISpecifyPropertyPages  *pISPP;
    CAUUID                  caGUID;
    HRESULT                 hr;
    LCID lcid = AmbientLocaleID();
    if (FAILED(m_pIDispatch->QueryInterface(IID_ISpecifyPropertyPages, (void **)&pISPP)))
    {
        AfxMessageBox("Object has no property pages.");
        return;
    }
    hr=pISPP->GetPages(&caGUID);
    pISPP->Release();
    if (FAILED(hr))
    {
        AfxMessageBox("Failed to retrieve property page GUIDs.");
        return;
    }
    hr=OleCreatePropertyFrame(m_hWnd, 10, 10, OLETEXT("Beeper")
        , 1, (IUnknown **)&m_pIDispatch, caGUID.cElems
        , caGUID.pElems, lcid, 0L, NULL);
    if (FAILED(hr))
        AfxMessageBox("OleCreatePropertyFrame failed.");
    //Free GUIDs.
    CoTaskMemFree((void *)caGUID.pElems);
    return;
}
Notes: I changed a few minor things to get this code compiled imeediately without any further changes. I changed Message method of BrockSchmidt to the standard AfxMessageBox(). Then, I replaced the 9th parameter from m_lcid to 0L because I am not interested in locale information (of course you have to take care of it if you support multiple languages!!!)
The theory of property pages, property pages browsing and notifications is slightly more difficult than that. I sincerely encourage you to read the sixteenth chapter of "Inside OLE" of BrockSchmidt to get the full picture of OLE property pages.


分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • 讨论一下activex方面的经典书目!
  • 紧急求助:关于ActiveX控件的使用问题!!
  • 在ActiveX控件中使用多线程后Fire事件的问题
  • 可以在ActiveX控件下的Dialog画曲线图吗
  • 怎么才能获得微软Activex控件的帮助信息呢
  • 如何在单文档中使用ActiveX控件那?
  • Activex,参数传入的汉字在英文系统下为乱码
  • 这样得Activex问题大家以前碰到么?
  • 嵌在网页里的ACTIVEX控件不能销毁的问题。
  • 又是关于ActiveX控件下载的问题,希望大家都来讨论一下!!!!

相关文章

  • 2017-06-05 vcocx注册问题
  • 2017-06-05 为什么读取的缓冲区数据位数不固定?
  • 2017-06-04 请帮我把这个程序改写成CUDAC代码,给好心人高分!
  • 2017-06-05 #import语句一般都是制定了一个绝对路径,这样编译的结果,有通用性么?
  • 2017-06-05 请教高手:控制台程序如何接收窗口关闭的消息
  • 2017-06-04 DCom高手来看看,有关com服务程序[in],[out]两种参数的传递的效率问题!
  • 2017-06-05 WINDOWSHalreadyincludedMFCappsmustnot#include<windowsh>是什么原因???
  • 2017-06-05 dll的加载help
  • 2017-06-04 高手看看WTLNOTIFY_CODE_HANDLER_EX的问题
  • 2017-06-05 HOOK键盘,逗号,句号小键盘数字HOOK得到的是乱码该如何处理?

文章分类

  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号

最近更新的内容

    • 如何用事件实现线程同步
    • howto怎样在线程中修改状态栏
    • 编写com的简单问题
    • 多谢雅克,帮俺解决了大问题。进来
    • 如何控制ie7选项卡
    • 使用COM可以实现这样的功能吗?
    • ActiveX和DirectX指的是什么?望不吝赐教!
    • 求[数据转发]解决方法和实现细节
    • 关于内存泄漏!
    • ActiveX控件加载图片资源,除了放到resource里,还有其它的方法吗?

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有