OleCreateLinkEx
Extends OleCreateLink
HRESULT OleCreateFromLinkEx(
LPMONIKER pmkLinkSrc, |
//Pointer to a moniker to object to create link to |
REFIID riid, |
//Reference to the identifier of the interface of
the link object to return |
DWORD dwFlags, |
//Value from OLECREATE |
DWORD renderopt, |
//Value from OLERENDER |
ULONG cFormats, |
//Number of FORMATETCs |
DWORD rgAdvf, |
//Points to an array of cFormats DWORD
elements |
LPFORMATETC rgFormatEtc, |
//Points to an array of cFormats FORMATETC
structures |
LPADVISESINK pAdviseSink, |
//IAdviseSink |
DWORD FAR* rgdwConnection, |
//Location to return array of dwConnection
values |
LPCLIENTSITE pClientSite, |
//Pointer to the primary interface the object will
to use to request services |
LPSTORAGE pStg, |
//Pointer to storage to use for the object |
LPVOID
FAR* ppvObj |
//Indirect pointer to location to return riid
interface |
); |
|
Parameters
pmkLinkSrc
Pointer to a
moniker to the object to create a link to.
riid
Reference to
the identifier of the interface of the object to return.
dwFlags
Value taken
from the OLECREATE
renderopt
Value taken
from the OLERENDER
cFormats
When renderopt
is OLERENDER_FORMAT, indicates the number of FORMATETC structures in the
rgFormatEtc array, which must be at least one. In all other cases, this
parameter must be zero.
rgAdvf
When renderopt
is OLERENDER_FORMAT, points to an array of cFormats DWORD elements,
each of which is a combination of values from the ADVF
rgFormatEtc
When renderopt
is OLERENDER_FORMAT, points to an array of cFormats FORMATETC
structures. When pAdviseSink is NULL, each element of this array is
passed as the pFormatEtc parameter to a call to the object s IOleCache::Cache
pAdviseSink
When renderopt
is OLERENDER_FORMAT, may be either a valid IAdviseSink
rgdwConnection
Location to
return the array of dwConnection values returned when the pAdviseSink
interface is registered for each advisory connection using IDataObject::DAdvise,
or NULL if the returned advisory connections are not needed. Must be NULL, if pAdviseSink
is NULL.
pClientSite
Pointer to
the primary interface through which the object will request services from its
container. This parameter may be NULL, in which case it is the caller s
responsibility to establish the client site as soon as possible using IOleObject::SetClientSite
pStg
Pointer to
the storage to use for the object and any default data or presentation caching
established for it.
ppvObj
Indirect
pointer to location to return the riid interface of the newly created
object.
Return Values
S_OK
Success.
E_NOINTERFACE
The object
does not support the riid interface.
E_INVALIDARG
One or more
arguments are invalid.
Remarks
The following
call to OleCreateLink:
OleCreateLink(pmkLinkSrc, riid, renderopt, pFormatEtc, pClientSite,
pStg, ppvObj);
is equivalent
to the following call to OleCreateLinkEx:
DWORD advf = ADVF_PRIMEFIRST;
OleCreateFromFileEx(pmkLinkSrc, riid, renderopt, 1, &advf,
pFormatEtc, NULL, NULL, pClientSite, pStg, ppvObj);
Existing
instantiation functions (OleCreate
Extended
versions of these creation functions solve this problem. OleCreateEx
Containers
requiring that multiple presentations be cached on their behalf by the object s
handler can simply call these functions and specify the number of formats in cFormats,
the ADVF flags for each format in rgAdvf, and the set of formats
in pFormatEtc. These containers pass NULL for pAdviseSink.
Containers
performing all their own data- or presentation-caching perform these same steps,
but pass a non-NULL pAdviseSink. They perform their own caching or
manipulation of the object or data during IAdviseSink::OnDataChange
These new
functions are for OLE Compound Documents. Using these functions, applications
can avoid the repeated launching and initialization steps required by the
current functions. They are targeted at OLE Compound Document container applications
that use default data- and presentation-caching, and also at applications that
provide their own caching and data transfer from the underlying IDataObject::DAdvise
support.
See Also