Solved

VC++ ERROR

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
fix34  challenge 9 122
firstChar challenge 13 115
c++ syntax question 9 49
Linker errors in DLL that uses a static library that has a class with static member functions 1 54
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

803 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