调试环境VS2005+IDL8.0
前文用到VC6.0和IDL8.0混合编程http://www.cnblogs.com/lartely/archive/2011/04/13/2014481.html
然而在VS2005中使用IDLDrawWidget有一些不同
首先Insert Activex Control导入IDLDrawWidget Control 3.0控件
在solution explorer中右击your project->"add"->"class...",选择"MFC class From ActiveX Control".选择"registry"单选框,并选择"IIDLDrawX3”
在dlg.h中添加
#include "CIDLDrawX3.h" class ... { ... public: CIDLDrawX3 m_idl; ... }
在dlg.cpp中添加
void ...Dlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_IDLDRAWWIDGET1, m_idl); } BOOL ...Dlg::OnInitDialog() { CDialog::OnInitDialog(); ... // TODO: Add extra initialization here m_idl.CreateDrawWidget(); m_idl.put_Xsize(200); m_idl.put_Ysize(200); m_idl.put_Xviewport(200); m_idl.put_Yviewport(200); m_idl.put_GraphicsLevel(1); m_idl.InitIDL((long)(this->m_hWnd)); m_idl.CreateDrawWidget(); m_idl.ExecuteStr(_T("tv,dist(200)")); ... }
结果