Solved

VC++ ERROR

Posted on 2009-05-16
6
581 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
C++ Language error 28 149
countEvens challenge 2 59
Eclipse Neon start with Admin account only 6 52
Making an alias 7 54
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

744 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

14 Experts available now in Live!

Get 1:1 Help Now