For the user-defined message simply do
#define WM_MYMESSAGE WM_USER + [offset]
replace [offset] by any number > 0 you want.

For MFC:
Add the ON_MESSAGE macro to the message map like this:
Code:
// example for ON_MESSAGE
#define WM_MYMESSAGE (WM_USER + 1)
BEGIN_MESSAGE_MAP( CMyWnd, CMyParentWndClass )
    //{{AFX_MSG_MAP( CMyWnd
    ON_MESSAGE( WM_MYMESSAGE, OnMyMessage )
    // ... Possibly more entries to handle additional messages
    //}}AFX_MSG_MAP
END_MESSAGE_MAP( )
OnMyMessage is the message handler function. It must have this prototype:
afx_msg LRESULT OnMyMessage(WPARAM, LPARAM);