![]() |
【转帖】how to save file with thumbnailimage included
how to save file with thumbnailimage included?
how to save file with thumbnailimage included? i save the dwg file by using writefile(fname,ftype,fversion,true), but the saved file does not contain a thumbnailimage which is in the origional one. what's the wrong? quote: originally posted by ideeinfo i save the dwg file by using writefile(fname,ftype,fversion,true), but the saved file does not contain a thumbnailimage which is in the origional one. what's the wrong? hi, which file version (fversion) do you use? dwg version > r12 and dxf > r14 may content thumbnailimage. that version of dwg direct do you use? best regards, sergey z. the dwg version is 2006 and the dwgdirect is 1.14.02. i compare the saved file with the original one, and find that the file size is decreased about 30~40kb after it is saved. the file explorer will show the thumbnailimage when i pick the oroginal one. last edited by ideeinfo; 24th july 2006 at 05:05 pmfff">. hi, check your implementation oddbhostappservices. it must contents implementation "odgsdeviceptr gsbitmapdevice()" method. you may use winbitmap.gs module from dwgdirect extensions. for example see odwriteex project. best regards, sergey z. by checking, i find that i use the same files exhostappservices.cpp and exsystemservices.cpp as that in the sample project odwriteex. then i add the file exgirasterimage.cpp to my project. but the results show no change has happened. quote: originally posted by ideeinfo by checking, i find that i use the same files exhostappservices.cpp and exsystemservices.cpp as that in the sample project odwriteex. then i add the file exgirasterimage.cpp to my project. but the results show no change has happened. your implementation must have "odgsdeviceptr gsbitmapdevice()". exsystemservices doen't have it. try to use next code ( from odwriteex.cpp): code: class myservices : public exsystemservices, public exhostappservices { protected: odrx_using_heap_operators(exsystemservices); odgsdeviceptr gsbitmapdevice() { try { odgsmoduleptr pgsmodule = ::odrxdynamiclinker()->loadmodule(dd_t("winbitmap.gs")); return pgsmodule->createbitmapdevice(); } catch(const oderror&) { } return odgsdeviceptr(); } }; #if !defined(_toolkit_in_dll_) || defined(__mwerks__) odrx_declare_static_module_entry_point(bitmapmodule); odrx_begin_static_module_map() odrx_define_static_appmodule (dd_t("winbitmap.gs"), bitmapmodule) odrx_end_static_module_map() #endif ... odstaticrxobject<myservices> svcs; ... odinitialize(&svcs); best regards, sergey z. then when i add this code, there occur the compiling errors: error c2143: syntax error : missing ';' before '(' error c2143: syntax error : missing ')' before ',' error c2501: 'this_file' : missing storage-class or type specifiers error c2059: syntax error : 'constant' point to the code line: odrx_using_heap_operators(exsystemservices); i don't know what's the reason. after some efforts, i make it be passed through compling and linking. but at runtime there is also an exception at the code: odgsmoduleptr pgsmodule = :drxdynamiclinker()->loadmodule(("winbitmap.gs")); which lists the error information "cxx0030: error: expression cannot be evaluated" in debug mode. so the returned value of pgsmodule is null. how can i do then. note: in the above code the text "dd_t" can not be used, otherwise an error of "undefined identifier" will be caused at compiling phase. dear sergey z. ok, i have finally got it resolved. thank you. quote: originally posted by ideeinfo dear sergey z. ok, i have finally got it resolved. thank you. it is very good. i am sorry about dd_t() ( i have got code from unicode project). best regards, sergey z. could you help me resolve it to please? i can't work out what libraries or headers to include for this function gsbitmapdevice to compile. i added a #include <gs.h> and thought i resolved it. in release mode it built with no errors. but when i ran the application the resulting dwg was 0 bytes. so i then tried debug mode and it would not compile: exgswin32device.obj : error lnk2001: unresolved external symbol "public: __thiscall odcommondeviceprops::odcommondeviceprops(void)" (??0odcommondeviceprops@@qae@xz) exgswin32device.obj : error lnk2001: unresolved external symbol "public: virtual void __thiscall odcommondeviceprops::generatepropmap(class odrxdictionary *)const " (?generatepropmap@odcommondeviceprops@@ubexpavodrx dictionary@@@z) exgswin32device.obj : error lnk2001: unresolved external symbol "public: virtual __thiscall odcommondeviceprops::~odcommondeviceprops(void)" (??1odcommondeviceprops@@uae@xz) ok, i got further, but i have what appears to be two unrelated problems. firstly, i removed all the exgswin32device etc files from my application because i could not see them included in the odamfcapp example project. next, after reading this message thread properly, i added this code at the top of my cpp file: #ifndef _toolkit_in_dll_ odrx_declare_static_module_entry_point(bitmapmodul e); odrx_begin_static_module_map() odrx_define_static_appmodule (dd_t("winbitmap.gs"), bitmapmodule) odrx_end_static_module_map() #endif next, i added a #include: #include <rxdynamicmodule.h> i made my gsbitmapdevice look like this: odgsdeviceptr cseq2dwgapp::gsbitmapdevice() { try { odgsmoduleptr pgsmodule = :drxdynamiclinker()->loadmodule(dd_t("winbitmap.gs")); return pgsmodule->createbitmapdevice(); } catch(const oderror&) { } return odgsdeviceptr(); } i added gs_winbitmap.lib to my library list and now the project compiles. but i get no bitmap preview. when i debug, the pointer returned is null. what steps have i missed? i have an unrelated problem which i will discuss in another thread. but i would appreciate a little guidance here from anyone who has the time. thank you. i did another hunt in the forum and noticed a comment about using: odrx_init_static_module_map(); in initinstance. this is the thing with sample applications. they are so huge, you miss what you actually need for simpler applications. but hooray for the support forum now i have a valid pointer, but i get an error when the bitmap is being created which shows in a message box: "object of class odgirasterimage can't be cast to odrasterconvertpe" ideas? bingo! a seperate thread showed the answer. so now my code is: #ifndef _toolkit_in_dll_ odrx_declare_static_module_entry_point(bitmapmodul e); odrx_declare_static_module_entry_point(odrasterpro cessingservicesimpl); odrx_begin_static_module_map() odrx_define_static_appmodule (dd_t("winbitmap.gs"), bitmapmodule) odrx_define_static_application(dd_t("rasterprocess or"), odrasterprocessingservicesimpl) odrx_end_static_module_map() #endif and i included dd_vc6mt_rxrasterprocessor.lib and now i have bitmap previews. |
所有的时间均为北京时间。 现在的时间是 10:40 PM. |