同样一段程序,为什么在vc++6.0下就可以运行,而在vs2010下就会报错呢?
本帖最后由 thefutureisour 于 2012-12-03 14:56:19 编辑
int CMainWindow::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
m_hLibrary = ::LoadLibrary(__T("fstrcv.dll"));
if(!m_hLibrary)
MessageBox(__T("装载模拟数据库失败!"));
INITCARD lpfunction = (INITCARD)::GetProcAddress(m_hLibrary, "InitCard");
if(!lpfunction)
{
MessageBox(__T("无法获取InitCard函数"));
return -1;
}
unsigned int uiCardNumber = (*lpfunction)((this->m_hWnd), WM_IRQSTOCK);
m_EnableMessage = (ENABLEMESSAGE)::GetProcAddress(m_hLibrary, "EnableMessage");
if(!m_EnableMessage)
MessageBox(__T("无法获取EnableMessage函数"));
m_recvInfo = (RECVINFO)::GetProcAddress(m_hLibrary,"ReceiveInfo");
if(!m_recvInfo)
MessageBox(__T("无法获取ReceiveInfo函数"));
m_DataAcquisition = (DATAAQUISITION)GetProcAddress(m_hLibrary,"DataAcquisition");
if(!m_DataAcquisition)
MessageBox(__T("无法获取DataAcquisition函数"));
return 0;
}
_AFXWIN_INLINE HINSTANCE AFXAPI AfxGetInstanceHandle()
{ ASSERT(afxCurrentInstanceHandle != NULL);
return afxCurrentInstanceHandle; }
unsigned?int?uiCardNumber?=?(*lpfunction)((this->m_hWnd),?WM_IRQSTOCK);
(*lpfunction)((this->m_hWnd),?WM_IRQSTOCK)