//used to differentiate prop, use SetData, GetData methodcmfcpropertygridproperty* pProp1 = new CMFCPropertyGridProperty (strtitle, (_variant_t) BVal, strdesc);Pprop1->setdata (+);int npropid = Pprop1->getdata ();
Declaring message handler functions
afx_msg LRESULT onpropertychanged (WPARAM wparam,lparam LPARAM);
Register message, afx_wm_property_changed: Send CTRL message to parent window
Begin_message_map (Cmywnd, CWnd)
On_wm_paint ()
On_wm_create ()
On_registered_message (afx_wm_property_changed, onpropertychanged)
End_message_map ()
Message processing, LPARAM is the property attribute item, WPARAM is the ID of CTRL
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;
}
CMFCPropertyGridCtrl Property changes the event code