几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


 
 
主题工具 搜索本主题 显示模式
旧 2009-05-04, 03:30 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】access violation exception with wingdi

access violation exception with wingdi
access violation exception with wingdi
i'm trying to use the wingdi system to render a view of a dwg file in a windows forms application. compiling under visual studio 2005 with default forms application settings except clr support rather than clr pure mode. using the latest dwgdirect libraries (2.2.)
starting with a blank control similar to how i've previously created mixed forms/opengl applications. since the application i was working on originally didn't work i have created the simplest clear code base that reproduces the same problem. in this simplified version i have a function which is called after the control initialisation is finished (visible on the screen) that does the following:
code:
odrxobjectimpl<exhostappservices> hostappservices;
odrxobjectimpl<exsystemservices> systemservices;
odinitialize(&systemservices);
odgsinitialize();
oddbdatabaseptr pdb = hostappservices.readfile(l"c:\\test.dwg");
if (pdb.isnull()) {
throw gcnew exception("error opening database");
}
odgsdeviceptr pdevice = exgsscreendevice<exgsgdivectorizedevice>::createobject();
if (pdevice.isnull()) {
throw gcnew exception("error creating gdi render device");
}
odrxdictionaryptr pproperties = pdevice->properties();
pproperties->putat(l"windowhwnd",odrxvariantvalue( (odint32)this->handle.toint32() ));

odgicontextfordbdatabaseptr pdwgcontext;
pdwgcontext->setdatabase(pdb);
pdevice = oddbgsmanager::setupactivelayoutviews(pdevice,pdwgcontext);
the code throws system.accessviolationexception from a point inside dd_db_2.02_8.dll when making the setupactivelayoutviews method.
i get a few linker warnings when compiling of the unresolved typeref token variety, but the code i write with the library seems to work otherwise. i've tested accessing text objects in the database to verify that it has opened for reading fine. pdf exporting works fine as well so the problem is fairly localized.
can anyone offer suggestions?
an update to this, i tried using the code as a module as suggested in another thread, and i get the same error from the same call. still not sure what to do about it
last edited by davidenglish; 1st march 2007 at 10:38 pmfff">.
did you read this:
?
if yes, and the problem persists, perhaps you may create a sample and send us to look at?
vladimir
yes i read that, have tried doing it by linking the gdi code in directly and calling odgsinitialize manually, and also by using the dynamic module (as in the sample.) similar error from the same call either way. i also tried using
attached a sample. i've simplified the code to the absolute minimum to reproduce the error. if you can shed any light on where i'm going wrong that'd be great, cheers!
attached files (179.2 kb, 18 views)

code:
odgicontextfordbdatabaseptr pdwgcontext;
pdwgcontext->setdatabase(pdb);
is the same as
code:
odgicontextfordbdatabase* pdwgcontext;
pdwgcontext->setdatabase(pdb);
note also that to do anything else than setupactivelayoutviews, you will need to store hostappservices, systemservices and gsdevice somewhere.
vladimir
apologies for that, i dropped the create object by mistake when i was simplifying the code to trace the problem.
similarly i wasn't storing the other objects anywhere because i was just trying to minimise code, they are retained in my original code base.
still not sure why the original doesn't work, but the sample appears to now, so i'll keep looking.
cheers
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】access violation during font mapping yang686526 DirectDWG 0 2009-05-04 03:30 PM
【转帖】access violation crash in recoverfile9file.dxf0 yang686526 DirectDWG 0 2009-05-04 03:29 PM
【转帖】access violation at program exi yang686526 DirectDWG 0 2009-05-04 03:29 PM
【转帖】(access violation reading 0xcccccccc)在线等呢 yang686526 ObjectARX(C++) 0 2009-04-14 02:29 PM
【转帖】rap unhandled exception even yang686526 SolidWorks二次开发 0 2009-04-13 03:02 PM


所有的时间均为北京时间。 现在的时间是 06:30 PM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多