Solved

Porting C to MFC

Posted on 1998-11-23
2
233 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Handling string inputs in C/Linux 23 168
cat dog challenge 18 122
Whole sheet autoscrub still needed 19 44
EvenOdd challenge 10 83
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now