win7系统下vc6.0运行程序出现KERNELBASE.DLL未处理的异常访问冲突错误!

My_lolo 2010-06-26 09:50:56
在Windows XP下编译、运行正常的程序,移植到Win7系统下编译正确,运行就报错,错误代码为:
unhandled exception in *.exe(kernelbase.dll):0xC0000005: access violation
跟踪后发现出现错误的地方为:
CToolBarCtrl *ctbctrl=(CToolBarCtrl*)&m_ToolBarT.GetToolBarCtrl();
ctbctrl->AddButtons(atoi(nNum,tb);//动态添加按钮

在Windows XP下Release的程序移植到Win7下,运行时也不能加载工具栏,问题也出现在这地方。

kernelbase.dll这个库文件在C:\Windows\System32下也存在。

请教大家,有遇到同样问题的或知道怎么解决的请给个答案,不胜感激!
...全文
1746 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
wilson 2013-01-09
  • 打赏
  • 举报
回复
我也遇到了同样的问题,不知道解决的办法。 程序在XP下运行很正常,但移到Win7下就跑不了了!
成功的理由333 2012-12-13
  • 打赏
  • 举报
回复
我和楼主的问题一样一样的,现在都不知道怎么解决!
aottnc 2011-04-15
  • 打赏
  • 举报
回复
我在运行到一个需要修改数据库的地方出现了这个错误,同时在XP下运行到相同的地方也是这个错误...
什么原因啊...
cn_loo 2010-12-10
  • 打赏
  • 举报
回复
数组错误!
My_lolo 2010-06-26
  • 打赏
  • 举报
回复
我在Windows XP下运行都是正常的啊
My_lolo 2010-06-26
  • 打赏
  • 举报
回复
我将动态添加工具栏部分贴出来大家帮参看下啊:
BOOL CZDBDlg::TOOLBar_Init()
{
if (!m_ToolBarT.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||!m_ToolBarT.LoadToolBar(IDR_TOOLBAR1))
{
MessageBox(w_str.GetAt(48),w_str.GetAt(192),MB_ICONEXCLAMATION);
return FALSE;
}

m_ImgListT.Create(ToolT_Size, ToolT_Size, ILC_COLOR32|ILC_MASK,0, 0);
CSize btnSize(ToolT_Size+7,ToolT_Size+21),imgSize(ToolT_Size,ToolT_Size);
m_ToolBarT.SetSizes(btnSize,imgSize);

TBBUTTON* tb = new TBBUTTON;
for(INT i=0;i<atoi(w_str.GetAt(420));i++)
{
tb->iBitmap = i;
// tb->idCommand = 100+i;
tb->fsState = TBSTATE_ENABLED;
tb->fsStyle = TBSTYLE_BUTTON;
tb->dwData = 0;
// tb->iString = 0;
}

// CToolBarCtrl *ctbctrl=(CToolBarCtrl*)&m_ToolBarT.GetToolBarCtrl();
// ctbctrl->AddButtons(atoi(w_str.GetAt(420))-1,tb);

m_ToolBarT.GetToolBarCtrl().AddButtons(atoi(w_str.GetAt(420))-1,tb);
// m_ToolBarT.SendMessage(TB_ADDBUTTONS, atoi(w_str.GetAt(420))-1,(LPARAM)tb);

delete tb;

int j=0;
for(i=0;i<atoi(w_str.GetAt(420));i++)
{
if(0==strlen(w_str.GetAt(421+i)))
{
// m_ToolBarT.GetToolBarCtrl().InsertButton(i, &Wrap);
m_ToolBarT.SetButtonInfo(i,ID_MENUITEM0001,TBBS_SEPARATOR,NULL);
}
else
{
m_ToolBarT.SetButtonInfo(i,(0==j)?ID_MENUITEM32771:((1==j)?ID_MENUITEM32772:((2==j)?ID_MENUITEM32777:((3==j)?ID_MENUITEM32811:ID_MENUITEM32822))),TBBS_BUTTON,j);
m_ToolBarT.SetButtonText(i,w_str.GetAt(421+i));
j++;
}
}
return TRUE;
}
zyq5945 2010-06-26
  • 打赏
  • 举报
回复
MSDN2008的参数是这个样子的
BOOL AddButtons(
int nNumButtons,
LPTBBUTTON lpButtons
);
nNumButtons
Number of buttons to add.

lpButtons
Address of an array of TBBUTTON structures that contains information about the buttons to add. There must be the same number of elements in the array as buttons specified by nNumButtons.
My_lolo 2010-06-26
  • 打赏
  • 举报
回复
编译可以通过,就是运行到这步就报错!
soswaidao 2010-06-26
  • 打赏
  • 举报
回复
程序在win7下编译看看
RAD Studio 10.2 Toyko Update2 10.2.2 KEYGEN 一键激活,安装时选择试用,安装完毕后一键激活即可。亲测可用!! Win10 Build 16299 旗舰版 亲测可用!!! 为了便于在 Lite 14.x 中使用大侠们的特别补丁,初步写成这个:Activator.exe 他的主要作用: 1、整合 elseif、unis、x-force、cjack 大虾的 Keygen 相对原始部署方式,这个 Activator 实现“一键激活”! 使用方法: 1、执行 Activator.exe 发布历史: 2017.12.14 - v14.2 1、根据 25.0.28979.1978 原版制作,基于 RadStudioKeygenSourceCodeTokyo10.2Update2CorrectedSetup.zip 的成果 2017.08.11 - v14.1 1、根据 25.0.27659.1188 原版制作,基于 elseif-Rad-Studio-Keygen-master upto 10.2.1 的成果 2017.03.26 - v14.0 1、根据 25.0.26309.314 原版制作,基于 elseif、unis、x-force、cjack 等大虾的成果 已知问题: 1、在一些操作系统上如果出现安全提示,直接确定即可。 特别感谢: 1、elseif、unis、x-force、cjack、crackerjack、dr、freecat、gateway、huayan889、kerlingen、sinner、yuto 等大侠的特别补丁,感谢诸位我知道的不知道的的大虾们的辛勤劳动! 2、iny、nevergrief、snakejiao、star5、tintin1943、ti9er、wang_80919、wuxiangyang 等等我知道的不知道的的网友们的热情测试! 3、andreas hausladen 等大虾们的无私贡献! O(∩_∩)O~ Delphi 10.2 and C++Builder 10.2 Updata2 亲测可用! Embarcadero® C++Builder 10.2 Version 25.0.28979.1978 Copyright © 2017 Embarcadero Technologies, Inc. All Rights Reserved. advapi32.dll, 10.0.16299.15, C:\WINDOWS\System32\ AEPIC.dll, 10.0.16299.15, C:\WINDOWS\SYSTEM32\ androiddebugide250.bpl, 25.0.28979.1978, d:\program files (x86)\embarcadero\studio\19.0\Bin\ appanalytics250.bpl, 25.0.28979.1978, D:\Program Files (x86)\Embarcadero\Studio\19.0\bin\ apphelp.dll, 10.0.16299.98, C:\WINDOWS\SYSTEM32\ applet250.bpl, 25.0.28979.1978, d:\program files (x86)\embarcadero\studio\19.0\bin\ asmview250.bpl, 25.0.28979.1978, d:\program files (x86)\embarcadero\studio\19.0\Bin\ ATL.DLL, 3.5.2284.0, C:\Windows\System32\ bcbandroid250.bpl, 25.0.28979.1978, d:\program files (x86)\embarcadero\studio\19.0\Bin\ bcbcoment250.bpl, 25.0.28979.1978, d:\program files (x86)\embarcadero\studio\19.0\Bin\ bcbcompro250.bpl, 25.0.28979.1978, d:\program files (x86)\embarcadero\studio\19.0\Bin\ bcbent250.bpl, 25.0.28979.1978, d:\program files (x86)\embarcadero\studio\19.0\Bin\ bcbfmxide250.bpl, 25.0.28979.1978, d:\program files (x86)\embarcadero\s

2,641

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 硬件/系统
社区管理员
  • 硬件/系统社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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