Solved

Creation of OLE Compound file ?

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MFC Dialog 9 49
Include multiple hostnames in this command? 3 55
java ^ examples 8 67
Problem to App source 6 40
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.
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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

803 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