WhipExamples/AppendBlocks.cpp

00001 //
00002 //  Copyright (c) 2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED,
00008 //  AS TO THE CORRECTNESS OF THIS CODE OR ANY DERIVATIVE
00009 //  WORKS WHICH INCORPORATE IT.
00010 //
00011 //  AUTODESK PROVIDES THE CODE ON AN "AS-IS" BASIS
00012 //  AND EXPLICITLY DISCLAIMS ANY LIABILITY, INCLUDING
00013 //  CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00014 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00015 //
00016 //  Use, duplication, or disclosure by the U.S. Government is subject to
00017 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00018 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00019 //  Data and Computer Software), as applicable.
00020 //
00021 
00022 #include "whiptk/whip_toolkit.h"
00023 #include "whiptk/w2d_class_factory.h"
00024 
00025 void AppendBlocks()
00026 {
00027     WT_W2D_Class_Factory cf;
00028     WT_File *file1 = cf.Create_File(), *file2 = cf.Create_File();
00029 
00030     file1->set_filename("c:\\test1.dwf");
00031     file1->heuristics().set_target_version(55);
00032 
00033     file2->set_filename("c:\\test2.dwf");
00034     file2->heuristics().set_target_version(55);
00035 
00036     file1->set_file_mode(WT_File::Block_Append);
00037     file1->open();
00038 
00039     WT_BlockRef overlay_ref;
00040     overlay_ref.set_format(WT_BlockRef::Overlay);
00041 
00042     GUID _guid;
00043     CoCreateGuid(&_guid);
00044     WD_GUID guid;
00045     memcpy(&guid, &_guid, sizeof(guid));
00046 
00047     WT_Guid overlay_block_guid(guid);
00048     overlay_ref.set_block_guid(overlay_block_guid);
00049 
00050     FILETIME ft;
00051     GetSystemTimeAsFileTime(&ft);
00052 
00053     WT_FileTime overlay_creation_time(ft.dwLowDateTime, ft.dwHighDateTime);
00054     overlay_ref.set_creation_time(overlay_creation_time);
00055 
00056     WT_FileTime overlay_modification_time(ft.dwLowDateTime, ft.dwHighDateTime);
00057     overlay_ref.set_modification_time(overlay_modification_time);
00058     overlay_ref.set_validity(WD_True);
00059 
00060     file1->desired_rendition().blockref() = overlay_ref;
00061     file1->write_block(*file2);
00062     file1->close();
00063     
00064     cf.Destroy(file1);
00065     cf.Destroy(file2);
00066 }

Generated on Tue Jan 6 22:40:01 2009 for Autodesk DWF Toolkit by  doxygen 1.4.5