1. error C2440:
'static_cast' : cannot convert from 'void (__thiscall CFilePropertySheet::* )(int)' to 'void (__thiscall CCmdTarget::* )(UINT)' d:\myproject\利亚德\110-vs2005\superedit\superedit\filepropertysheet.cpp 45
Wrong:
afx_msg void DisplayPage(int Page);
ON_COMMAND_RANGE( IDD_PROPPAGE_FILE1, IDD_PROPPAGE_FILE1, DisplayPage )
void CFilePropertySheet::DisplayPage(int Page)
改为
Right:
afx_msg void DisplayPage(UINT Page);
ON_COMMAND_RANGE( IDD_PROPPAGE_FILE1, IDD_PROPPAGE_FILE1, DisplayPage )
void CFilePropertySheet::DisplayPage(UINT Page)
2. error C2440:
'static_cast' : cannot convert from 'void (__thiscall CSuperEditDoc::* )(WPARAM,LPARAM)' to 'AFX_PMSG' d:\myproject\利亚德\110-vs2005\superedit\superedit\supereditdoc.cpp 60
Wrong:
afx_msg void OnCtrlNew(WPARAM wParam, LPARAM lParam);
ON_COMMAND(ID_CTRL_NEW, OnCtrlNew)
void CSuperEditDoc::OnCtrlNew(WPARAM wParam, LPARAM lParam)
{
OnCtrlNew01();
}
因为VS2005 doc不支持 WM_COMMAND消息
改为
Right:
3. error C2675:
unary '!' : 'std::_Vector_iterator<_Ty,_Alloc>' does not define this operator or a conversion to a type acceptable to the predefined operator d:\myproject\利亚德\110-vs2005\superedit\superedit\pageview.cpp 396
Wrong:
vector<CLDCControl *>::iterator it = m_Vector_SelControl.begin();
if (!it)
{
return;
}
改为
Right:
vector<CLDCControl *>::iterator it = m_Vector_SelControl.begin();
CLDCControl *pCtrl = *it;
if (!pCtrl)
{
return;
}
4. error C2668:
'sqrt' : ambiguous call to overloaded function
could be 'long double sqrt(long double)'
Wrong:
int delt = b*sqrt(a*a - (x-center.x)*(x-center.x))/a;
改为
Right:
int delt = b*sqrt(double(a*a - (x-center.x)*(x-center.x)))/a;
5. error C4430:
missing type specifier - int assumed. Note: C++ does not support default-int
Wrong:
extern "C" _declspec(dllexport) g_GetCtrlIcon02(CString *str)
{
str->Format("%s", "TextSmallIcon.ico");
}
改为
Right:
extern "C" _declspec(dllexport) void g_GetCtrlIcon02(CString *str)
6. 项目默认编译设置是 mobil debug in mobil win32 sys: 去掉mobil
SuperEditRes2052 缺少资源文件
1 需要研究的代码
BOOL CSystemInfo::GetMacAddress(CString &Mac) //获得网卡MAC地址
{
/* UINT uErrorCode = 0;
IP_ADAPTER_INFO iai;
ULONG uSize = 0;
DWORD dwResult = GetAdaptersInfo( &iai, &uSize );
if( dwResult == ERROR_BUFFER_OVERFLOW )
{
IP_ADAPTER_INFO* piai = ( IP_ADAPTER_INFO* )HeapAlloc( GetProcessHeap( ), 0, uSize );
if( piai != NULL )
{
dwResult = GetAdaptersInfo( piai, &uSize );
if( ERROR_SUCCESS == dwResult )
{
IP_ADAPTER_INFO* piai2 = piai;
while( piai2 != NULL && ( uSystemInfoLen + piai2->AddressLength ) < 4096U )
{
CopyMemory( szSystemInfo + uSystemInfoLen, piai2->Address, piai2->AddressLength );
uSystemInfoLen += piai2->AddressLength;
piai2 = piai2->Next;
}
}
else
{
uErrorCode = 0xF0000000U + dwResult;
}
VERIFY( HeapFree( GetProcessHeap( ), 0, piai ) );
}
else
{
return FALSE;
}
}
else
{
uErrorCode = 0xE0000000U + dwResult;
}
if( uErrorCode != 0U )
{
return FALSE;
} */
CString strMac;
NCB ncb;
ADAPTER_STATUS adapt;
memset(&ncb,0,sizeof(ncb));
ncb.ncb_command = NCBRESET;
//首先对网卡发送一个NCBRESET命令以便进行初始化
Netbios(&ncb);
ncb.ncb_command = NCBASTAT;
strcpy((char *)ncb.ncb_callname,"*");
// 指定返回的信息存放的变量
ncb.ncb_buffer = (unsigned char *)&adapt;
ncb.ncb_length = sizeof(adapt);
// 发送NCBASTAT命令以获取网卡的信息
Netbios(&ncb);
// 把网卡MAC地址格式化成常用的进制形式
strMac.Format("%02X%02X%02X%02X%02X%02X",
adapt.adapter_address[0],
adapt.adapter_address[1],
adapt.adapter_address[2],
adapt.adapter_address[3],
adapt.adapter_address[4],
adapt.adapter_address[5]);
Mac = strMac;