Solved

Porting C to MFC

Posted on 1998-11-23
2
243 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Login Script to Copy Folders 12 50
Detect CR LF to each line 12 184
only14 challenge 19 89
abstract class with all non abstract mentods 6 87
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…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 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