|
Define the message name:
#define message name (e.g. UWM_SEND_LINE) (WM_APP + 0x100)
// Receive message window class
Class CMyDialog
{
proteted:
afx_msg LRESULT [Get message function name] (WPARAM, LPARAM);
}
// BEGIN_MESSAGE_MAP (CMyDialog, CDialog)
ON_MESSAGE (message name, get message function name)
// END_MESSAGE_MAP ()
// Get the message function entity
LRESULT CMyDialog :: Get message function name (WPARAM wParam, LPARAM lParam)
{
// The example here is only a CPoint type object.If it is an arbitrary type object such as CRect, it will become
// CRect * pRect = (CRect) wParam; CRect m_rect = * pRect; ...
LPCTSTR * pPoint = (LPCTSTR *) wParam;
CPoint point1 = * Point;
// poin1 is the point value you want to get
// ........................................
return 0;
}
CMyView :: Name of function to pass point value ()
{
CPoint myPoint; // Also CRect myObj, etc.
:: SendMessage (Dialog object name.GetSafeHwnd (), message name, (long)&myPoint, 0);
// If you don't get the dialog object name variable, you can send this message to the main frame window to relay it.
// It should be easy to get the dialog object variables
// :: SendMessage (AfxGetMaiWnd ()-> GetSafeHwnd (), message name, (long)&myPoint, 0);
} |
|