| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Managed C++ and C++/CLI Discuss Managed C++ and .NET-specific questions related to C++. |
![]() |
|
|
Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
#1
|
|||
|
|||
|
BUILD Error 2440
Hi,
I have the follow error while I compile a program from visual c++(visual studio 6.0) to visual studio .net.. This is the code where I have the error: In the header file: Code:
afx_msg BOOL OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct); in the .cpp file Code:
ON_MESSAGE(WM_COPYDATA, OnCopyData) This is the body of function: //----------------------------------------------------------------------------- BOOL CPwSafeDlg::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct) { DWORD dwLen, dwPasswordLen, dwKeyFileLen; CString strData, strPassword, strKeyFile, strFile; NotifyUserActivity(); if(pCopyDataStruct->lpData != NULL) { dwLen = (DWORD)_tcslen((LPCTSTR)pCopyDataStruct->lpData); if(dwLen == 0) return TRUE; strData = (LPCTSTR)pCopyDataStruct->lpData; dwPasswordLen = pCopyDataStruct->dwData >> 16; dwKeyFileLen = pCopyDataStruct->dwData & 0xffff; if((dwPasswordLen + dwKeyFileLen) >= dwLen) return TRUE; if(dwPasswordLen != 0) strPassword = strData.Mid(0, dwPasswordLen); if(dwKeyFileLen != 0) strKeyFile = strData.Mid(dwPasswordLen, dwKeyFileLen); if((dwPasswordLen + dwKeyFileLen) != 0) strFile = strData.Right(strData.GetLength() - (int)dwPasswordLen - (int)dwKeyFileLen); else strFile = strData; if(strFile.GetLength() == 0) return TRUE; OnFileClose(); if(m_bFileOpen == TRUE) return TRUE; if((dwPasswordLen != 0) && (dwKeyFileLen != 0)) _OpenDatabase(strFile, strPassword, strKeyFile, FALSE, NULL); else if(dwPasswordLen != 0) _OpenDatabase(strFile, strPassword, NULL, FALSE, NULL); else if(dwKeyFileLen != 0) _OpenDatabase(strFile, NULL, strKeyFile, FALSE, NULL); else _OpenDatabase(strFile, NULL, NULL, FALSE, NULL); if((m_bMinimized == TRUE) || (m_bShowWindow == FALSE)) OnViewHide(); } return TRUE; } /---------------------------------------------- The error message is: error C2440: "static_cast": impossibile convertire da "BOOL (__thiscall CPwSafeDlg::* )(CWnd *,COPYDATASTRUCT *)" a "LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)".. Can anyone able to help me, please? Thank you very much..
__________________
spynet "Software is like sex, it's better when it's free." - Linus Torvalds Last edited by spynet; July 19th, 2005 at 09:57 AM. Reason: Correct TITLE |
|
#2
|
|||
|
|||
|
Re: BUILD Error 2440
Your message handling function must have the parameter format (WPARAM, LPARAM). You can then cast the LPARAM to a COPYDATASTRUCT* in the function.
__________________
Please don't forget to rate users who helped you! |
|
#3
|
|||
|
|||
|
Re: Build Error 2440
Sorry,
Can you show me an example? Thank you for your reply.
__________________
spynet "Software is like sex, it's better when it's free." - Linus Torvalds Last edited by spynet; July 20th, 2005 at 04:54 AM. |
|
#4
|
|||
|
|||
|
Re: Buod Error 2440
Code:
afx_msg LRESULT OnCopyData(WPARAM wParam, LPARAM lParam);
ON_MESSAGE(WM_COPYDATA, OnCopyData)
LRESULT CPwSafeDlg::OnCopyData(WPARAM wParam, LPARAM lParam)
{
COPYDATASTRUCT* pCopyDataStruct = (COPYDATASTRUCT*)lParam;
DWORD dwLen, dwPasswordLen, dwKeyFileLen;
CString strData, strPassword, strKeyFile, strFile;
NotifyUserActivity();
if(pCopyDataStruct->lpData != NULL)
{
dwLen = (DWORD)_tcslen((LPCTSTR)pCopyDataStruct->lpData);
if(dwLen == 0) return TRUE;
strData = (LPCTSTR)pCopyDataStruct->lpData;
dwPasswordLen = pCopyDataStruct->dwData >> 16;
dwKeyFileLen = pCopyDataStruct->dwData & 0xffff;
if((dwPasswordLen + dwKeyFileLen) >= dwLen) return TRUE;
if(dwPasswordLen != 0) strPassword = strData.Mid(0, dwPasswordLen);
if(dwKeyFileLen != 0) strKeyFile = strData.Mid(dwPasswordLen, dwKeyFileLen);
if((dwPasswordLen + dwKeyFileLen) != 0)
strFile = strData.Right(strData.GetLength() - (int)dwPasswordLen - (int)dwKeyFileLen);
else strFile = strData;
if(strFile.GetLength() == 0) return TRUE;
OnFileClose();
if(m_bFileOpen == TRUE) return TRUE;
if((dwPasswordLen != 0) && (dwKeyFileLen != 0))
_OpenDatabase(strFile, strPassword, strKeyFile, FALSE, NULL);
else if(dwPasswordLen != 0)
_OpenDatabase(strFile, strPassword, NULL, FALSE, NULL);
else if(dwKeyFileLen != 0)
_OpenDatabase(strFile, NULL, strKeyFile, FALSE, NULL);
else
_OpenDatabase(strFile, NULL, NULL, FALSE, NULL);
if((m_bMinimized == TRUE) || (m_bShowWindow == FALSE)) OnViewHide();
}
return TRUE;
}
__________________
Please don't forget to rate users who helped you! Last edited by philkr; July 19th, 2005 at 11:13 AM. Reason: Correction |
|
#5
|
|||
|
|||
|
Re: BUILD Error 2440
Hi,
now I have the follow error... error C2440: "static_cast": impossibile convertire da "BOOL (__thiscall CPwSafeDlg::* )(CWnd *,WPARAM,LPARAM)" a "LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)".....
__________________
spynet "Software is like sex, it's better when it's free." - Linus Torvalds |
|
#6
|
||||
|
||||
|
Re: Buod Error 2440
Code:
ON_MESSAGE( /* ... */ ) Code:
LRESULT CMyWindow::OnMessage ( WPARAM wParam, LPARAM lParam ); Code:
ON_WM_COPYDATA( /* ... */ )
__________________
I am not offering technical guidiance via email or IM Come on share your photo with us! CG members photo album! Use the Code Tags! |
|
#7
|
|||
|
|||
|
Re: Build Error 2440
Hi,
I am confused, I must use ON_WM_COPYDATA( /* ... */ ) instead of ON_MESSAGE(WM_COPYDATA, OnCopyData)... Sorry but I not understand.....
__________________
spynet "Software is like sex, it's better when it's free." - Linus Torvalds Last edited by spynet; July 20th, 2005 at 04:54 AM. |
|
#8
|
|||
|
|||
|
Re: Buod Error 2440
Did it work with my correcte version? I'm curious.
__________________
Please don't forget to rate users who helped you! |
|
#9
|
|||
|
|||
|
Re: Buod Error 2440
Hi,
you can download the source code from http://keepass.sourceforge.net/ I use visual studio .net 7.1- framework 1.1 I await.. your solution.... Thanks for your patience
__________________
spynet "Software is like sex, it's better when it's free." - Linus Torvalds |
|
#10
|
|||
|
|||
|
Re: Buod Error 2440
I mean. Do you still have errors with the version I posted before. Because I edited it. It's different from the version you already tested and about which you said it would still have errors.
__________________
Please don't forget to rate users who helped you! |
|
#11
|
|||
|
|||
|
Re: Build Error 2440
Hi,
Now it's ok. Thank you very much for your patience and for your attention. I have understand the solution and why there was the error... By and good holiday. Crismer
__________________
spynet "Software is like sex, it's better when it's free." - Linus Torvalds |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|