Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Porting C to MFC

Posted on 1998-11-23
2
Medium Priority
?
248 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 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

618 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