0xC0000005: 读取位置 0x00000000 时发生访问冲突

蓝水海域 2012-10-22 11:12:29
CSmartHopperTestToolDlg::CSmartHopperTestToolDlg(CWnd* pParent /*=NULL*/)
: CDialogEx(CSmartHopperTestToolDlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
HINSTANCE hinstDLL = LoadLibrary("SmartHopper.dll");

m_Init = (tInit)GetProcAddress(hinstDLL,"Init");
m_Start = (tStart)GetProcAddress(hinstDLL,"Start");
m_Reset = (tReset)GetProcAddress(hinstDLL,"Reset");
m_Exit = (tExit)GetProcAddress(hinstDLL,"Exit");
m_Enable = (tEnable)GetProcAddress(hinstDLL,"Enable");
m_Disable = (tDisable)GetProcAddress(hinstDLL,"Disable");
m_Poll = (tPoll)GetProcAddress(hinstDLL,"Poll");
m_SetRouting = (tSetRouting)GetProcAddress(hinstDLL,"SetRouting");
m_GetRouting = (tGetRouting)GetProcAddress(hinstDLL,"GetRouting");
m_SetCoinAmount = (tSetCoinAmount)GetProcAddress(hinstDLL,"SetCoinAmount");
m_GetCoinAmount = (tGetCoinAmount)GetProcAddress(hinstDLL,"GetCoinAmount");
m_PayoutAmount = (tPayoutAmount)GetProcAddress(hinstDLL,"PayoutAmount");
m_FloatByDenomination = (tFloatByDenomination)GetProcAddress(hinstDLL,"FloatByDenomination");
m_EmptyCoin = (tEmptyCoin)GetProcAddress(hinstDLL,"EmptyCoin");
m_CashBoxPayoutOperationData = (tCashBoxPayoutOperationData)GetProcAddress(hinstDLL,"CashBoxPayoutOperationData");
//硬币识别
m_StartCoinRecognition=(tStartCoinRecognition)GetProcAddress(hinstDLL,"StartCoinRecognition");
m_CloseCoinRecognition=(tCloseCoinRecognition)GetProcAddress(hinstDLL,"CloseCoinRecognition");
m_CoinRecognition=(tCoinRecogniton)GetProcAddress(hinstDLL,"CoinRecognition");
}
/*硬币识别模块从动态库引用函数,初始化m_StartCoinRecognition的值为0x000000000????为什么会这样呢?*/[——————————
//开始硬币的识别
void CSmartHopperTestToolDlg::OnBnClickedButton15()
{
// TODO: 在此添加控件通知处理程序代码
int ret=m_CloseCoinRecognition(100);
if(ret!=0xF0) MessageBox("开启识别一元失败");

ret=m_CloseCoinRecognition(50);
if(ret!=0xF0) MessageBox("开启识别五角失败");

ret=m_CloseCoinRecognition(10);
if(ret!=0xF0) MessageBox("开启识别一角失败");

MessageBox("开始成功");
}
...全文
513 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
同求 累死问题
nixy_ 2012-10-22
  • 打赏
  • 举报
回复
可能是你的dll使用问题,像1L说的方法名称不对,或者是你的dll版本问题
FrankieWang008 2012-10-22
  • 打赏
  • 举报
回复
"SmartHopper.dll 里面是不是没有StartCoinRecognition方法啊?或者说不叫这个名字,你用dependence 看看
suzhaoning21 2012-10-22
  • 打赏
  • 举报
回复
可能是引入dll时有问题,换成隐式调用试试
赵4老师 2012-10-22
  • 打赏
  • 举报
回复
崩溃的时候在弹出的对话框按相应按钮进入调试,按Alt+7键查看Call Stack里面从上到下列出的对应从里层到外层的函数调用历史。双击某一行可将光标定位到此次调用的源代码或汇编指令处。

64,654

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧