Converting parameters in MFC "Error C2440"

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2007
Posts: 30
Reputation: Fouly is an unknown quantity at this point 
Solved Threads: 0
Fouly Fouly is offline Offline
Light Poster

Converting parameters in MFC "Error C2440"

 
0
  #1
Apr 17th, 2009
Hi,

I tried the following snippet of code

  1. BEGIN_MESSAGE_MAP(CSpeechDlg, CDialog)
  2. //{{AFX_MSG_MAP(CSpeechDlg)
  3. ON_WM_SYSCOMMAND()
  4. ON_WM_PAINT()
  5. ON_WM_QUERYDRAGICON()
  6. ON_BN_CLICKED(IDC_BUTTON_VOICE_TRAINING, OnButtonVoiceTraining)
  7. ON_BN_CLICKED(IDC_BUTTON_MICRO_SETUP, OnButtonMicroSetup)
  8. ON_BN_CLICKED(IDC_BUTTON_SPEAK, OnButtonSpeak)
  9. ON_BN_CLICKED(IDC_BUTTON_ABOUT, OnButtonAbout)
  10. //}}AFX_MSG_MAP
  11. ON_MESSAGE(WM_RECOEVENT,OnRecoEvent)
  12. END_MESSAGE_MAP()

but i got an error at this line:
  1. ON_MESSAGE(WM_RECOEVENT,OnRecoEvent)
the error is :
  1. Error 1 error C2440: 'static_cast' : cannot convert from 'void (__thiscall CSpeechDlg::* )(void)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
here's the definitions for the passing parameters:
  1. #define WM_RECOEVENT WM_USER+5
OnRecoEvent is a void function...
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 142
Reputation: MrSpigot is on a distinguished road 
Solved Threads: 34
MrSpigot's Avatar
MrSpigot MrSpigot is offline Offline
Junior Poster

Re: Converting parameters in MFC "Error C2440"

 
0
  #2
Apr 20th, 2009
You haven't shown the signature for OnRecoEvent(), but it should be like this:-
Declare the function in CSpeechDlg as:
afx_msg LRESULT OnRecoEvent(WPARAM wp, LPARAM lp);

and define it as:
LRESULT CSpeechDlg::OnRecoEvent(WPARAM wp, LPARAM lp)
{
return 0; // or 1
}
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 30
Reputation: Fouly is an unknown quantity at this point 
Solved Threads: 0
Fouly Fouly is offline Offline
Light Poster

Re: Converting parameters in MFC "Error C2440"

 
0
  #3
Apr 20th, 2009
well the building error is solved but i got a run time error!!!

here's the error:
  1. Runtime Error!
  2.  
  3. R6034
  4. An application has made an attempt to load C runtime library incorrectly.
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 142
Reputation: MrSpigot is on a distinguished road 
Solved Threads: 34
MrSpigot's Avatar
MrSpigot MrSpigot is offline Offline
Junior Poster

Re: Converting parameters in MFC "Error C2440"

 
0
  #4
Apr 20th, 2009
Originally Posted by Fouly View Post
well the building error is solved but i got a run time error!!!

here's the error:
  1. Runtime Error!
  2.  
  3. R6034
  4. An application has made an attempt to load C runtime library incorrectly.
Check out this error in MSDN R6034
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 30
Reputation: Fouly is an unknown quantity at this point 
Solved Threads: 0
Fouly Fouly is offline Offline
Light Poster

Re: Converting parameters in MFC "Error C2440"

 
0
  #5
Apr 20th, 2009
I set the generation of the mainfest file property to yes but i got the same error!!!
check this
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC