|
// PicShower.cpp : Implementation of CPicShower
#include "stdafx.h"
#include "PictureATL.h"
#include "PicShower.h"
/////////////////////////////////////////////////////////////////////////////
// CPicShower
/* -------------------------------------------------------------------------
This only works, if it�s in the same space process
------------------------------------------------------------------------- */
STDMETHODIMP CPicShower::SetDirectMeta(LPUNKNOWN Picture)
{
_Pict = Picture; // Assign the picture
FireViewChange(); // Force to redraw the ActiveX
return S_OK;
}
/* -------------------------------------------------------------------------
Ok, this method works in all the places ( in proccess, out of
process, ...). The Picture is saved in memory in one stream, then
we open that stream and load the picture
------------------------------------------------------------------------- */
STDMETHODIMP CPicShower::SetMeta(LPUNKNOWN Stream)
{
CComQIPtr<IStream> pStream = Stream;
if(pStream) {
CComPtr<IPictureDisp> pic; // Using one smart pointer to get the Picture Dispatch
LARGE_INTEGER l;
l.QuadPart =0;
pStream->Seek(l, STREAM_SEEK_SET, NULL);
OleLoadPicture(pStream, l.LowPart, FALSE, IID_IPictureDisp, (void **) &pic);
if(pic) {
_Pict = pic; // Ok, QInterface smart pointer...
}
FireViewChange(); // Force to redraw
}
return S_OK;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Braulio is a developer specialized on Ms Technologies (Silverlight, ASP .net, SSRS, SSAS, SSIS). Currently he is working for Avanade in Málaga and as a journalist for the Spanish .net magazine Dotnetmania. He also is the webmaster of an specializad in .net technologies site Tipsdotnet.com, and Silverlight Based DB Schema Editor (www.dbschemaeditor.com).