How to dynamically load ActiveX controls at runtime?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: How to dynamically load ActiveX controls at runtime?

  1. #1
    Join Date
    Jun 2001
    Posts
    5

    How to dynamically load ActiveX controls at runtime?

    The conventional way to load/create ActiveX control is to do it in the Resource Editor, 'Insert ActiveX Control', and the MFC ClassWizard will generate all the .cpp/.h files.

    What if I have an ActiveX control registered in my system, and I want to dynamically create and run it in my dialog-based MFC application, at runtime? Should I use CreateControl or CoCreateInstance? Can someone post a simple code snipplet on how to achieve this? Thanks in advance.


  2. #2
    Join Date
    Apr 2000
    Location
    San Francisco, California, USA
    Posts
    4,467

    Re: How to dynamically load ActiveX controls at runtime?

    In an MFC application you should use CWnd::CreateControl.

    Below is a sample that creates WebBrowser control:


    if (!m_Browser.CreateControl(CLSID_WebBrowser, NULL, WS_VISIBLE|WS_CHILD,
    CRect(0,0,100,100), this, nID))
    return NULL;





    Russian Software Development Network -- http://www.rsdn.ru

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center