查看单个帖子
旧 2009-05-06, 11:44 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】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:pendocumentfile(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
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)