Home   Index   About
Ultimate Pack


Custom Search
OleCreateStaticFromData

The OleCreateStaticFromData function creates a static object (containing only a representation, with no native data) from a data transfer object.

HRESULT OleCreateStaticFromData(

LPDATAOBJECT pSrcDataObj,
//Data transfer object holding data used to create new object
REFIID riid,
//Interface to be used to communicate with the new object
DWORD renderopt,
//Value from OLERENDER
LPFORMATETC pFormatEtc,
//Depending on renderopt, pointer to value from FORMATETC
LPOLECLIENTSITE pClientSite,
//Points to instance of IOleClientSite
LPSTORAGE pStg,
//Points to instance of IStorage used to store object
LPVOID FAR* ppvObj
//Receives a pointer to the interface requested in riid
);

Parameters

pSrcDataObj

Points to the data transfer object that holds the data from which the object will be created.

riid

Identifies the interface with which the caller is to communicate with the new object (usually IID_IOleObject).

renderopt

A value from the enumeration OLERENDER indicating the locally cached drawing or data-retrieval capabilities that the container wants in the newly created component. It is an error to pass the render options OLERENDER_NONE or OLERENDER_ASIS to this function.

pFormatEtc

Depending on which of the OLERENDER flags is used as the value of renderopt, may be one of the FORMATETC enumeration values. Refer to the OLERENDER enumeration for restrictions.

pClientSite

Points to an instance of IOleClientSite, the primary interface through which the object will request services from its container. May be NULL.

pStg

Points to an instance of the IStorage interface to be used as the storage for the object. This parameter may not be NULL.

ppvObj

When the function returns successfully, contains a pointer to the interface requested in riid on the newly created object.

Return Value

S_OK

Indicates that the object was successfully created.

Comments

The OleCreateStaticFromData function can convert any object that provides an IDataObject interface to a static object. It is useful in implementing the Convert To Picture option for OLE linking or embedding.

Static objects can be created only if the source supports one of the OLE-rendered clipboard formats: CF_METAFILEPICT, CF_DIB, or CF_ BITMAP, and CF_ENHMF.

Static objects can be pasted from the clipboard using OleCreateStaticFromData. The OleQueryCreateFromData function will return OLE_S_STATIC if one of CF_METAFILEPICT, CF_DIB, or CF_BITMAP is present and an OLE format is not present. But, in that case, the OleCreateFromData function does not automatically create the static object pics/OLE00090000.gif if the container will be pasting a static object it should call OleCreateStaticFromData.

The new static object is of class CLSID_StaticMetafile (in the case of CF_METAFILEPICT) and CLSID_StaticDib (in the case of CF_DIB or CF_BITMAP). The static object sets the OLEMISC_STATIC and OLE_CANTLINKINSIDE bits returned from IOleObject::GetMiscStatus. The static object will have the aspect DVASPECT_CONTENT and a LINDEX of -1.

The pDataObject is still valid after OleCreateStaticFromData returns. It is the caller's responsibility to free pDataObject pics/OLE00090000.gif OLE does not release it.

There cannot be more than one presentation stream in a static object.

Note The OLESTREAM<->IStorage conversion functions also convert static objects.

See Also

OleCreateFromData


Last news from Greatis Software

Nostalgia .Net     Nostalgia .Net     .Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes.  More »

Recommended software for developers

Ultimate Pack for Delphi and C++ Builder     Ultimate Pack     Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price.  More »

Form Designer .Net     Form Designer .Net     Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro!  More »

Print Suite .Net     Print Suite .Net     Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available  More »

Gradient Controls .Net     Gradient Controls .Net     Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available  More »

iGrid     Greatis iGrid     iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors.  More »


All the contacts and projects

Dmitry Vasiliev (just.dmitry)

Related Links

Software for Visual Studio .NET developers
Software for Delphi and C++ Builder developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET

More Online Helps

Win32 Programmer's Reference
Win32 Multimedia Programmer's Reference
OLE Programmer's Reference
Microsoft Windows Pen API Programmer's Reference
Microsoft Windows Sockets 2 Reference
Microsoft Windows Telephony API (TAPI) Programmer's Reference
Unix Manual Pages

Free Tech Secrets ;) Copyright © 2008-2012 Free Tech Secrets ;) greatis just4fun network just4fun