Solved

VC++ ERROR

Posted on 2009-05-16
6
584 Views
Last Modified: 2013-12-14
please help me these are the error i am getting while compiling

//Function prototype
class CMAXDpu4eDlg : public CDialog
{      
// Construction
public:
      CMAXDpu4eDlg(CWnd* pParent = NULL);      // standard constructor
      CMxDpms  *pDpms;
// Function declarationss to handle messages issued by DPUSnap
      afx_msg LRESULT OnStoreSnapShotExt(LPARAM,WPARAM); //Store Snapshot
      afx_msg LRESULT OnRestoreSnapShotExt(LPARAM,WPARAM); //Restore Snapshot
      afx_msg LRESULT OnReset(LPARAM lParam,WPARAM wParam);//Reset Map File,etc.
      afx_msg LRESULT OnRunFreeze(LPARAM lParam,WPARAM wParam); //Run/Freeze Dpu
}


BEGIN_MESSAGE_MAP(CMAXDpu4eDlg, CDialog)
      //{{AFX_MSG_MAP(CMAXDpu4eDlg)
      ON_WM_SYSCOMMAND()
      ON_WM_PAINT()
      ON_WM_QUERYDRAGICON()
      ON_WM_TIMER()
      //}}AFX_MSG_MAP
#ifdef _WIN32_WCE
      ON_REGISTERED_MESSAGE(m_sbpTwoSec, DropIt)
#endif
      ON_REGISTERED_MESSAGE(APCMessage, VectorAPC)
// Here we are mapping functions to messages issued by DPUSnap
  ON_MESSAGE(WM_USER_DPU_SNP_STORE,CMAXDpu4eDlg::OnStoreSnapShotExt)
      ON_MESSAGE(WM_USER_DPU_SNP_RESTORE,CMAXDpu4eDlg::OnRestoreSnapShotExt)
      ON_MESSAGE(WM_USER_DPU_RESET,CMAXDpu4eDlg::OnReset)
      ON_MESSAGE(WM_USER_DPU_RUN_FREEZE,CMAXDpu4eDlg::OnRunFreeze)

END_MESSAGE_MAP()

function Body

LRESULT CMAXDpu4eDlg::OnStoreSnapShotExt(LPARAM lParam,WPARAM wParam)
/********************************************************************
Purpose     : Handler for Storing Snapshot
Called By      : by a Store Snapshot Message from DPU SNAP
Return            :
Calls to      :
Remarks            :
Remember!      :
**********************************************************************/
{
      InitMapFile();
      pDpms->m_DpuFileName=chPtr;
      OnSnapShot();
      return TRUE;
 
}
error

\MAXDpu4eDlg.cpp(234) : error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CMAXDpu4eDlg::* )(LPARAM,WPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
        Cast from base to derived requires dynamic_cast or static_cast
.\MAXDpu4eDlg.cpp(235) : error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CMAXDpu4eDlg::* )(LPARAM,WPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
        Cast from base to derived requires dynamic_cast or static_cast
.\MAXDpu4eDlg.cpp(236) : error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CMAXDpu4eDlg::* )(LPARAM,WPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
        Cast from base to derived requires dynamic_cast or static_cast
.\MAXDpu4eDlg.cpp(237) : error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CMAXDpu4eDlg::* )(LPARAM,WPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
        Cast from base to derived requires dynamic_cast or static_cast
0
Comment
Question by:sudhirbai
6 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 168 total points
ID: 24407159
ON_MESSAGE(WM_USER_DPU_SNP_STORE,CMAXDpu4eDlg::OnStoreSnapShotExt)

should be
ON_MESSAGE(WM_USER_DPU_SNP_STORE,&CMAXDpu4eDlg::OnStoreSnapShotExt)

and the same for the other errors (note the &)
0
 
LVL 86

Assisted Solution

by:jkr
jkr earned 166 total points
ID: 24407180
The '&' is not the problem, the explicit class name prefix is what keeps the compiler from using the ase class contersion. Try
BEGIN_MESSAGE_MAP(CMAXDpu4eDlg, CDialog)
      //{{AFX_MSG_MAP(CMAXDpu4eDlg)
      ON_WM_SYSCOMMAND()
      ON_WM_PAINT()
      ON_WM_QUERYDRAGICON()
      ON_WM_TIMER()
      //}}AFX_MSG_MAP
#ifdef _WIN32_WCE
      ON_REGISTERED_MESSAGE(m_sbpTwoSec, DropIt)
#endif
      ON_REGISTERED_MESSAGE(APCMessage, VectorAPC)
// Here we are mapping functions to messages issued by DPUSnap
  ON_MESSAGE(WM_USER_DPU_SNP_STORE,OnStoreSnapShotExt)
      ON_MESSAGE(WM_USER_DPU_SNP_RESTORE,OnRestoreSnapShotExt)
      ON_MESSAGE(WM_USER_DPU_RESET,OnReset)
      ON_MESSAGE(WM_USER_DPU_RUN_FREEZE,OnRunFreeze)
 
END_MESSAGE_MAP()

Open in new window

0
 
LVL 49

Assisted Solution

by:DanRollins
DanRollins earned 166 total points
ID: 24408334
It looks like most of the errors are caused by a parameter reversal:
afx_msg LRESULT OnStoreSnapShotExt(LPARAM,WPARAM); //Store Snapshot
should probably be
afx_msg LRESULT OnStoreSnapShotExt(WPARAM,LPARAM); //Store Snapshot
---------------------------------------------------^^^^^^^^^^^^
But you will need to check the DPUSnap documentation (I don't have that available to me)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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
wordmultiple challenge 12 141
c++ syntax question 9 52
Eclipse IDE - Cannot copy/paste from console output 8 254
Not needed 13 119
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
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.

856 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