Solved

Creation of OLE Compound file ?

Posted on 1998-07-29
3
681 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 200 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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 video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

696 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