你可以在VC环境中通过Project-->add To Project-->Components and Controls添加一个控件,看它是怎么实现的,然后跟着它去尝试。
一般有包装类的,然后利用那个包装类就可以create了
我看到过OLE的类,但不知道怎么用,有谁能告诉我吗? 我很急呀——
http://www.codeguru.com/activex/SDas.html Dynamic creation and placement of ActiveX controls - Saurabh Dasgupta (2001/09/10) Most of the applications that use ActiveX controls, do so by embedding them at design time. This article demonstrates how simple it is to create and place Active X controls at run time.
或者给我的油箱发一个例子好吗[email protected]
我很急呀——
Dynamic creation and placement of ActiveX controls - Saurabh Dasgupta (2001/09/10)
Most of the applications that use ActiveX controls, do so by embedding them at design time. This article demonstrates how simple it is to create and place Active X controls at run time.
CAxWindow content_wnd;
......
if( _tcslen(m_tcHtmlFileName) > 0 )
{
RECT rc;
GetClientRect( &rc );
if(m_spBrowser==NULL)
{
LPOLESTR pstrbrowserid;
StringFromCLSID(IID_IWebBrowser2,&pstrbrowserid);
_bstr_t bstrbrowser(pstrbrowserid);
CoTaskMemFree(pstrbrowserid);
if(content_wnd.IsWindow())
content_wnd.DestroyWindow();
content_wnd.Create( m_hWnd, rc, LPCTSTR(bstrbrowser), WS_CHILD¦WS_VISIBLE¦WS_HSCROLL¦WS_VSCROLL );//create a browser control
HRESULT hrbrowser;
hrbrowser = content_wnd.QueryControl( IID_IWebBrowser2, reinterpret_cast<void**>(&m_spBrowser) );
}