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

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】problems creating database (http://www.dimcax.com/hust/showthread.php?t=18196)

yang686526 2009-05-06 11:44 PM

【转帖】problems creating database
 
problems creating database
problems creating database
hi
i'm developing for pocket pc and i have started from odamfcappce example.
i'm also using odamfcapp example to guide me in the creation of operations to a dwg file.
in the odamfcappce example it is defined a variable (m_pdb) to receive the database of a dwg file, but in odamfcapp example, the odamfcappdoc class is used as the database, defining a cdwgdoctemplate class that creates the database and manually adds the document.
it seems to me that the odamfcapp way is more correct int the mfc document / view structure, so i´d like t use it in my program, but i´m having problems:
like in odamfcapp, i've add this function to the csigpropapp class:
odrxclass* csigpropapp::databaseclass() const{
return sigpropdoc::desc();
}
my csigpropdoc class inherits from oddbdatabase and i added to the cpp:
#define docreate(class, px) px.attach((csigpropdoc*)csigpropdoc::createobject( ));
odrx_cons_define_members(csigpropdoc, oddbdatabase, docreate);
and to the .h:
odrx_declare_members(csigpropdoc);
and i created a class that extends csingledoctemplate (in odamfcapp it extends cmultidoctemplate but that is not possible in evc) and defines a opendocumentfile function that is called to add a document:
cdocument* csigpropdoctemplate::opendocumentfile(lpctstr lpszpathname,bool bmakevisible)
{
uses_conversion;
odsmartptr<csigpropdoc> pdocument;
oddbdatabaseptr pdb;
if (lpszpathname == null)
{
pdb= theapp.createdatabase(true,oddb::kmetric);
}
. . .
}
it compiles without any errors, but when it tries to create the database in the the code above, it throws an exception of access violation.
am i proceding correctly, in addopting the doc class to be the database in a evc project? if so, what am i doing wrong?
please help me because i'm really stuck at this point!
(if it is necessary to correct my problem, i attatched my doc, doctemplate and app files)
thanks in advance
pedro tenreiro
attached files


所有的时间均为北京时间。 现在的时间是 03:22 AM.