spynet
July 19th, 2005, 09:44 AM
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:
afx_msg BOOL OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct);
in the .cpp file
ON_MESSAGE(WM_COPYDATA, OnCopyData)
(Here this is the point of error)...
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..
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:
afx_msg BOOL OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct);
in the .cpp file
ON_MESSAGE(WM_COPYDATA, OnCopyData)
(Here this is the point of error)...
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..