Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 249
  • Last Modified:

Porting C to MFC

I am porting my C to MFC, now I face a problem, i.e. retrieving the wParam and lParam. In C, I have a standard Windows Procedure passing parameters of Message, wParam, and lParam. I can then make use of these wParam and lParam.

In MFC, I use MESSAGE_MAP to map my private message (not Standard Windows' message). Here, how can I retrieve the wParam and lParam parameters that passed to my private message?

Example
#define MY_MESSAGE (WM_USER + 1)

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
      //{{AFX_MSG_MAP(CMainFrame)
      ON_WM_CREATE()
      ON_MESSAGE(MY_MESSAGE, OnMyMessage)
      //}}AFX_MSG_MAP
END_MESSAGE_MAP()

CMainFrame::OnMyMessage()
{
  if (wParam==ONE_PARAMETER)
  {...}
  else
  {...}
}

Any help will be very much appreciated!!
0
tangkh
Asked:
tangkh
1 Solution
 
prasanthCommented:
Your CMainFrame::OnMyMessage should actually be CMainFrame::OnMyMessage(WPARAM wParam, LPARAM lParam)...

Map Entry
ON_MESSAGE( <message>, <memberFxn> )

Function Prototype
afx_msg LRESULT memberFxn(WPARAM, LPARAM);
0
 
tangkhAuthor Commented:
Thanks for your quick and effective answer :)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now