标签:
//声明消息处理函数
afx_msg LRESULT OnPropertyChanged( WPARAM wParam,LPARAM lParam );
//注册消息, AFX_WM_PROPERTY_CHANGED:发送ctrl消息到父窗口
BEGIN_MESSAGE_MAP(CMyWnd, CWnd)
ON_WM_PAINT()
ON_WM_CREATE()
ON_REGISTERED_MESSAGE(AFX_WM_PROPERTY_CHANGED, OnPropertyChanged)
END_MESSAGE_MAP()
//消息处理, lParam是Property属性项, wParam是ctrl的id
LRESULT CMyWnd::OnPropertyChanged( WPARAM wParam,LPARAM lParam )
{
CMFCPropertyGridProperty* pProp = (CMFCPropertyGridProperty*) lParam;
//is the property ctrl
if ( (long)wParam == 2 )
{
}
pProp->SetValue((_variant_t)false);
pProp->Redraw();
int pID = pProp->GetData();
CString str = pProp->GetName();
if ( str == _T("abc") )
{
COleVariant var = pProp->GetValue();
if ( var.boolVal == VARIANT_TRUE )
{
// AfxMessageBox(L"failed!");
//pProp->SetValue(VARIANT_FALSE);
}
}
if (pID == 1)
{
}
if (pID > 1)
{
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/ccjt/p/4463331.html