CMFCPropertyGridCtrl Property Change event code

Source: Internet
Author: User

//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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.