Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This method returns the time the object was last changed.

Syntax

HRESULT GetTimeOfLastChange( 
  IBindCtx* 
pbc, 
  IMoniker* 
pmkToLeft, 
  FILETIME* 
pFileTime
);

Parameters

pbc

[in] Pointer to the bind context to be used in this binding operation.

The bind context caches objects bound during the binding process, contains parameters that apply to all operations using the bind context, and provides the means by which the moniker implementation should retrieve information about its environment.

For more information, see IBindCtx.

pmkToLeft

[in] If the moniker is part of a composite moniker, pointer to the moniker to the left of this moniker.

This parameter is primarily used by moniker Implementers to enable cooperation between the various components of a composite moniker. Moniker clients should pass NULL.

pFileTime

[out] Pointer to the FILETIMEstructure receiving the time of last change.

A value of {0xFFFFFFFF,0x7FFFFFFF} indicates an error (for example, exceeded time limit, information not available).

Return Value

The method supports the standard return value E_UNEXPECTED.

The following table shows the additional return values for this method.

Value Description

S_OK

The method successfully returned a time.

MK_E_EXCEEDEDDEADLINE

The binding operation could not be completed within the time limit specified by the bind context's BIND_OPTSstructure.

MK_E_CONNECTMANUALLY

The operation was unable to connect to the storage for this object, possibly because a network device could not be connected to.

For more information, see IMoniker::BindToObject.

MK_E_UNAVAILABLE

The time of the change is unavailable, and will not be available no matter what deadline is used.

Remarks

To determine whether the platform supports this interface, see Determining Supported COM APIs.

Notes to Callers

If you are caching information returned by the object identified by the moniker, you may want to ensure that your information is up to date. To do so, you would call IMoniker::GetTimeOfLastChangeand compare the time returned with the time you last retrieved information from the object.

For the monikers stored within linked objects, IMoniker::GetTimeOfLastChangeis primarily called by the default handler's implementation of the IOleObject::IsUpToDatemethod.

Container applications call IOleObject::IsUpToDateto determine if a linked object (or an embedded object that contains linked objects) is up-to-date without actually binding to the object. This enables an application to determine quickly which linked objects require updating when the end user opens a document.

The application can then bind only those linked objects that need updating (after prompting the end user to determine whether they should be updated), instead of binding every linked object in the document.

Notes to Implementers

It is important to perform this operation quickly because, for linked objects, this method is called when a user first opens a compound document. Consequently, your IMoniker::GetTimeOfLastChangeimplementation should not bind to any objects.

In addition, your implementation should check the deadline parameter in the bind context and return MK_E_EXCEEDEDDEADLINE if the operation cannot be completed by the specified time.

There are a number of strategies you can use in your implementations:

  • For many types of monikers, the pmkToLeftparameter identifies the container of the object identified by this moniker. If this is true of your moniker class, you can simply call IMoniker::GetTimeOfLastChangeon the pmkToLeftparameter because an object cannot have changed at a date later than its container.

  • You can get a pointer to the Running Object Table (ROT) by calling the IBindCtx::GetRunningObjectTablemethod on the pbcparameter, and then calling the IRunningObjectTable::GetTimeOfLastChangemethod, because the ROT generally records the time of last change.

  • You can get the storage associated with this moniker (or the pmkToLeftmoniker) and return the storage's last modification time with a call to the IStorage::Statmethod.

Requirements

Header objidl.h, objidl.idl
Library ole32.lib, uuid.lib
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also