July 9th, 2001, 02:33 PM
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.
July 9th, 2001, 04:06 PM
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))
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!