Solved

Porting C to MFC

Posted on 1998-11-23
2
239 Views
Last Modified: 2013-11-20
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
Comment
Question by:tangkh
2 Comments
 
LVL 2

Accepted Solution

by:
prasanth earned 50 total points
ID: 1325174
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
 

Author Comment

by:tangkh
ID: 1325175
Thanks for your quick and effective answer :)
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
deburging in oracle form 12 100
format the code in java 6 95
unix example issues 18 91
Capture logon name 13 74
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question