From: Mark F. on
I have an image control that I use to display gif and jpg images. Using
an IPicture object how do I create a stream to save the file to disk?

IPicture * m_pPicture; // in header

// in .cpp

HRESULT hr;
IStream *pStream = NULL;
LONG size;

// I need to know how to create the proper stream here...

m_pPicture->SaveAsFile(pStream, FALSE, &size);


Thanks,
Mark



From: Ajay Kalra on
Heres an example of IPicture:

http://msdn.microsoft.com/msdnmag/issues/01/10/c/

GDI+ might be easier. There is also the CImage class.

--
Ajay Kalra [MVP - VC++]
ajaykalra(a)yahoo.com


"Mark F." <replytogroup(a)news.com> wrote in message
news:GRAJg.5391$o42.569(a)tornado.texas.rr.com...
> I have an image control that I use to display gif and jpg images. Using
> an IPicture object how do I create a stream to save the file to disk?
>
> IPicture * m_pPicture; // in header
>
> // in .cpp
>
> HRESULT hr;
> IStream *pStream = NULL;
> LONG size;
>
> // I need to know how to create the proper stream here...
>
> m_pPicture->SaveAsFile(pStream, FALSE, &size);
>
>
> Thanks,
> Mark
>
>
>


From: Mark F. on
Thanks, but that doesn't explain how to properly create the stream to
save the file to disk. There are dozens of articles on how to load and
display images. I have resized the image and I need to write the new
image in m_pPicture to disk file.

Mark

"Ajay Kalra" <ajaykalra(a)yahoo.com> wrote in message
news:uOBQIKQzGHA.4452(a)TK2MSFTNGP05.phx.gbl...
> Heres an example of IPicture:
>
> http://msdn.microsoft.com/msdnmag/issues/01/10/c/
>
> GDI+ might be easier. There is also the CImage class.
>
> --
> Ajay Kalra [MVP - VC++]
> ajaykalra(a)yahoo.com
>
>
> "Mark F." <replytogroup(a)news.com> wrote in message
> news:GRAJg.5391$o42.569(a)tornado.texas.rr.com...
> > I have an image control that I use to display gif and jpg images.
Using
> > an IPicture object how do I create a stream to save the file to
disk?
> >
> > IPicture * m_pPicture; // in header
> >
> > // in .cpp
> >
> > HRESULT hr;
> > IStream *pStream = NULL;
> > LONG size;
> >
> > // I need to know how to create the proper stream here...
> >
> > m_pPicture->SaveAsFile(pStream, FALSE, &size);
> >
> >
> > Thanks,
> > Mark
> >
> >
> >
>
>


From: David Ching on
"Mark F." <replytogroup(a)news.com> wrote in message
news:GRAJg.5391$o42.569(a)tornado.texas.rr.com...
>I have an image control that I use to display gif and jpg images. Using
> an IPicture object how do I create a stream to save the file to disk?
>
> IPicture * m_pPicture; // in header
>
> // in .cpp
>
> HRESULT hr;
> IStream *pStream = NULL;
> LONG size;
>
> // I need to know how to create the proper stream here...
>
> m_pPicture->SaveAsFile(pStream, FALSE, &size);
>
>
> Thanks,
> Mark
>
>
>


In Paul diLascia's CPicture class (from a MSJ/MSDN article, you can google
it) has:

BOOL CPictureOle::Load(CArchive& ar)
{
CArchiveStream arcstream(&ar);
return Load((IStream*)&arcstream);
}

so it seems you can use an MFC CArchiveStream and cast it to an IStream.


Paul has written actually two CPicture classes, one uses OleLoadPicture (the
one you want), the other uses GDI+.

-- David
http://www.dcsoft.com


From: Ajay Kalra on
> Paul has written actually two CPicture classes, one uses OleLoadPicture
(the
> one you want), the other uses GDI+.
>

I missed the one which uses GDI+. Was it in MSDN as well?

--
Ajay Kalra [MVP - VC++]
ajaykalra(a)yahoo.com