在CXXXCTRL类中用DoPropExchange()方法,具体如下实现:
if (pPX->GetVersion() == (DWORD)MAKELONG(_wVerMinor, _wVerMajor))
{
PX_Short(pPX, _T("Test"), (short &)m_test);
}
//....不知道各位有没有碰到这样奇怪的问题?
if (pPX->GetVersion() == (DWORD)MAKELONG(_wVerMinor, _wVerMajor))
{
PX_Short(pPX, _T("Test"), (short &)m_test);
}
//....不知道各位有没有碰到这样奇怪的问题?
估计没有进if里的语句
dispinterface _DXXX
{
properties:
// NOTE - ClassWizard will maintain property information here.
// Use extreme caution when editing this section.
//{{AFX_ODL_PROP(CConComocx2Ctrl)
[id(1)] short Test;
//}}AFX_ODL_PROP
methods:
//....略
[id(DISPID_ABOUTBOX)] void AboutBox();
};
控制头文件中对Test的定义如下:
// Dispatch maps
//{{AFX_DISPATCH(CConComocx2Ctrl)
short m_test;
afx_msg void OnTestChanged();
//....略
//}}AFX_DISPATCH
DECLARE_DISPATCH_MAP()
具体实现脚本安全,可以参考MSDN上的文章,主要实现以下2个函数:
HRESULT RegisterCLSIDInCategory()
HRESULT CreateComponentCategory()MSDN上的文章地址如下:
http://support.microsoft.com/kb/161873/