?
Solved

Creation of OLE Compound file ?

Posted on 1998-07-29
3
Medium Priority
?
683 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1319895
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
ID: 1319896
I would like to know at implementaion level.


0
 
LVL 7

Accepted Solution

by:
galkin earned 400 total points
ID: 1319897
// 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month15 days, 2 hours left to enroll

771 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