Solved

Creation of OLE Compound file ?

Posted on 1998-07-29
3
674 Views
Last Modified: 2013-11-20
Hi
          I  want  write the VC code which will take a list of files of different types (eg: x.doc, x.bmp,x.ppt) and embedds all the files in to a single file.
 I have few doubts. They are
Can this problem be solved using OLE Compound file ?
Can this problem be solved using RichEdit control?

I have few more doubts.They are

Using  StgCreateDocFile() create Compound file, which returns a IStorage pointer, using this
IStorage pointer can we embedd the files  in to the above created Compund file?

Can we use OleCreateFromFile() ?



Looking for reply....

Ramesh

         
0
Comment
Question by:ocx
3 Comments
 
LVL 15

Expert Comment

by:Tommy Hui
Comment Utility
The answer to your program is a storage file. Each of the files you mentioned can be stored as a stream (IStream) in the storage file. Don't forget that you can use a hierarchy of streams and storages within a storage file as well.
0
 

Author Comment

by:ocx
Comment Utility
I would like to know at implementaion level.


0
 
LVL 7

Accepted Solution

by:
galkin earned 200 total points
Comment Utility
// this is code for creating new compound file
// if you want to browse existing compounf file
// use StgOpenStorage instead

USES_CONVENTION;

LPSTORAGE lpStorage;
SCODE sc = ::StgCreateDocfile(T2COLE(lpszPathName),                    STGM_READWRITE|STGM_TRANSACTED|STGM_SHARE_EXCLUSIVE|STGM_CREATE,
                        0, &lpStorage);

if(sc != S_OK)
return;

// you can also created additional storages from root
// storage with with lpStorage->CreateStorage


COleStreamFile stream;

if(!stream.OpenStream(lpStorage, _T("your stream name")))
return;

// you can use stream as CFile derive class or create CArchive
// object tired to this CFile derived object

CArchive ar(&file, CArchive::load | CArchive::bNoFlushOnDelete);

lpStorage->Commit(STGC_ONLYIFCURRENT);
lpStorage->Release();
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now