![]() |
【转帖】opendwg and vc==.ne
opendwg and vc++.net
opendwg and vc++.net hi, i've modified the odreadex.cpp file of the odreadex sample. the program compiles and runs well. now i want to put the modified code in a new project without all the unnessary stuff of the odreadex sample and use this code in a vc++.net project (with managed code). how can i realise this? which files e.g. do i need to include? the code i want to use in my .net app is as follows: try { // create a database and load the drawing into it. oddbdatabaseptr pdb; pdb = svcs.readfile(filename, false, false, oda::ksharedenyno ); if (!pdb.isnull()) { oddbblocktablerecordptr pspace = pdb->getmodelspaceid().safeopenobject(); oddbobjectiteratorptr pi = pspace->newiterator(); for (pi->start(); !pi->done(); pi->step()) { oddbentityptr pent = pi->entity(); if (pent->iskindof(oddbblockreference::desc())) { oddbblockreferenceptr pblockref = pent; oddbobjectiteratorptr poi = pblockref->attributeiterator(); while( !poi->done() ) { oddbattributeptr pattr = poi->entity(); if (!pattr->isconstant()) std(cout) << pattr->tag() << pattr->textstring()); poi->step(); } } } } else { std(cout) << "error: cannot open file."; } } catch (oderror& e) { std(cout) << "dwgdirect error: " << svcs.geterrordescription(e.code()).c_str() << std(endl) << std(endl); } catch (...) { std(cout) << "unknown error." << std(endl) << std(endl); } } you need to include your implementation of oddbhostappservices and oddbsystemservices interfaces. or you can use exhostappservices and exsystemservices sample implementations. if you use them you'll need to include odfilebuf. as for exgirasterimage and exundocontroller you can exclude them from the project but remove references to them from exservices - simply return null from corresponding functions. sergey slezkin thanks for your reply. i've done what you said. now i want to make a dll from the project so that i can invoke the function that i've made from my managed c++ project. do you know how i can realize that? thanks in advance. |
所有的时间均为北京时间。 现在的时间是 12:26 AM. |