This article was contributed by Petr Stejskal. I wanted to create a control which would behave as a dialog or formview (you can place controls here). There is a simple way to do it - to take advantage of ActiveX. Create a new MFC ActiveX ControlWizard workspace (no need to special options).
Insert a new dialog resource named IDC_MYDIALOG (check following: style - child, border - dialog frame, visible, control, static edge)
Insert a new MFC class named CMyDialog (base class CDialog)
Add CMyDialog m_MyDialog member to your CDialogCtrl header source (don't forget to add #include "MyDialog.h")
Using classwizard add a member function OnCreate (WM_CREATE)
int CDialogCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (COleControl::OnCreate(lpCreateStruct) == -1)
return -1; m_MyDialog.Create(IDD_MYDIALOG, this);
return 0;
}Modify the member function OnDraw (the dialog's size depends on the WIDTH and HEIGHT specified in the HTML file): void CDialogCtrl::OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
// TODO: Replace the following code with your own drawing code.
// pdc->FillRect(rcBounds, CBrush::FromHandle((HBRUSH)GetStockObject(WHITE_BRUSH)));
// pdc->Ellipse(rcBounds); m_MyDialog.MoveWindow(rcBounds, TRUE);
}
然后我再到codeguru上找,找不到这个贴子了然后MSDN搜索,发现Q155973 ,上面说有个sample 在http://support.microsoft.com/download/support/mslfiles/Dlgx.exe可是已经无法下载然后上MSDN在线搜索,无结果:(我用上面的方法可以生成OCX,但调用时却根本无法create
连vb也死掉了
Insert a new dialog resource named IDC_MYDIALOG (check following: style - child, border - dialog frame, visible, control, static edge)
Insert a new MFC class named CMyDialog (base class CDialog)
Add CMyDialog m_MyDialog member to your CDialogCtrl header source (don't forget to add #include "MyDialog.h")
Using classwizard add a member function OnCreate (WM_CREATE)
int CDialogCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (COleControl::OnCreate(lpCreateStruct) == -1)
return -1; m_MyDialog.Create(IDD_MYDIALOG, this);
return 0;
}Modify the member function OnDraw (the dialog's size depends on the WIDTH and HEIGHT specified in the HTML file): void CDialogCtrl::OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
// TODO: Replace the following code with your own drawing code.
// pdc->FillRect(rcBounds, CBrush::FromHandle((HBRUSH)GetStockObject(WHITE_BRUSH)));
// pdc->Ellipse(rcBounds); m_MyDialog.MoveWindow(rcBounds, TRUE);
}
然后我再到codeguru上找,找不到这个贴子了然后MSDN搜索,发现Q155973 ,上面说有个sample 在http://support.microsoft.com/download/support/mslfiles/Dlgx.exe可是已经无法下载然后上MSDN在线搜索,无结果:(我用上面的方法可以生成OCX,但调用时却根本无法create
连vb也死掉了
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货