Some Error when compiling a VC6 code with VS2008... Please Help
-
Thursday, February 18, 2010 8:16 PM
Playsound.cpp
BEGIN_MESSAGE_MAP(PlaySound1, CWinThread)
ON_THREAD_MESSAGE(WM_PLAYSOUND_STARTPLAYING, OnStartPlaying)END_MESSAGE_MAP()
Error
playsound.cpp(38) : error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall PlaySound1::* )(WPARAM,LPARAM)' to 'void (__thiscall CWinThread::* )(WPARAM,LPARAM)'1> None of the functions with this name in scope match the target type
I tried to put the whole source and header files .. but the page can't disply them all
can anyone help :)- Edited by Just Click Thursday, February 18, 2010 8:22 PM
Answers
-
Friday, February 19, 2010 6:04 PM
For the OnStartPlaying function change LRESULT to void
At the end of the function remove the "return" statement.
- Marked As Answer by Nancy ShaoModerator Wednesday, February 24, 2010 6:30 AM
-
Friday, February 19, 2010 6:06 PM
Most people are not going to download a whole project.
In your PlaySound1 class definition in playsound.h, you must a have a method that is declared
LRESULT OnStartPlaying(WPARAM wParam, LPARAM lParam);
or maybe
afx_msg LRESULT OnStartPlaying(WPARAM wParam, LPARAM lParam);
Change LRESULT to void.
Likewise, in playsound.cpp you must have the implementation
LRESULT PlaySound1::OnStartPlaying(WPARAM wParam, LPARAM lParam)
{
// code is here
}
Again, replace LRESULT by void. And change the return statements in the function to eliminate the return value.
This was actually a breaking change in VC7 and later compared to VC6.
David Wilkinson | Visual C++ MVP- Marked As Answer by Nancy ShaoModerator Wednesday, February 24, 2010 6:30 AM
All Replies
-
Thursday, February 18, 2010 8:22 PM
Your message handler function signature is wrong. Its return type should be void.
VC6 did not detect errors in message handler signatures.- Proposed As Answer by jinzai Monday, February 22, 2010 8:28 PM
-
Friday, February 19, 2010 2:58 PMFirst of all ... Thanks Mr.Scott for the very very fast answer :)
This is the link to the complete project. If u please, download and compile it. There are a few errors that I have solved, but I couldn’t solve the error that I showed before cause I have a little experience in programming…. Can anyone exactly show me how to fix this problem ??
http://www.codeproject.com/KB/IP/videonet/VideoNet_src.zip
Thanks All -
Friday, February 19, 2010 6:04 PM
For the OnStartPlaying function change LRESULT to void
At the end of the function remove the "return" statement.
- Marked As Answer by Nancy ShaoModerator Wednesday, February 24, 2010 6:30 AM
-
Friday, February 19, 2010 6:06 PM
Most people are not going to download a whole project.
In your PlaySound1 class definition in playsound.h, you must a have a method that is declared
LRESULT OnStartPlaying(WPARAM wParam, LPARAM lParam);
or maybe
afx_msg LRESULT OnStartPlaying(WPARAM wParam, LPARAM lParam);
Change LRESULT to void.
Likewise, in playsound.cpp you must have the implementation
LRESULT PlaySound1::OnStartPlaying(WPARAM wParam, LPARAM lParam)
{
// code is here
}
Again, replace LRESULT by void. And change the return statements in the function to eliminate the return value.
This was actually a breaking change in VC7 and later compared to VC6.
David Wilkinson | Visual C++ MVP- Marked As Answer by Nancy ShaoModerator Wednesday, February 24, 2010 6:30 AM
-
Monday, February 22, 2010 5:06 PMthanks all,
all things work perfectly
thanks again :) -
Monday, February 22, 2010 5:08 PMWould you mind selecting Scott's and/or Dave's posts as your answer, then? Thanks.

