Solved

VC++ ERROR

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

749 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