Solved

VC++ ERROR

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

919 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

18 Experts available now in Live!

Get 1:1 Help Now