# IBindStatusCallback::GetBindInfo

An asynchronous moniker calls this method to obtain the bind information for the bind operation.

HRESULT GetBindInfo(

DWORD *pgrfBINDF, | //Pointer to BINDF value
BINDINFO *pbindinfo | //Pointer to BINDINFO structure
); |

Parameters

pgrfBINDF
  [out] Pointer to a value taken from the BINDF enumeration indicating whether the bind should proceed synchronously or asynchronously.
pbindinfo
  [in, out] Pointer to the BINDINFO structure which describes how the client wants the binding to occur.

Return Values

S_OK
  The operation was successful.
E_INVALIDARG
  One or more parameters are invalid.

Remarks

The moniker calls this method in its implementations of IMoniker::BindToObject and IMoniker::BindToStorage to obtain information about the specific bind operation.

Asynchronous moniker clients should be aware that a moniker may call IBindStatusCallback::GetBindInfo more than once during a bind operation. A proper implementation of GetBindInfo should prepare for this possibility. If returning data in the pBindInfo parameter, the implementation should allocate the appropriate data(szExtraInfo and/or stgmedData) at the time of each call. In this way, if the callback is never called, data is never allocated, and if the callback is called more than once, it will work correctly. The first time this callback is received by the asynchronous moniker client is before the call to IMoniker::BindToStorage or IMoniker::BindToObject.

Note Even when the value of pgrfBINDF is BINDF_ASYNCHRONOUS, it is possible that the original call to IMoniker::BindToStorage or IMoniker::BindToObject may return synchronously rather than returning the MK_S_ASYNCHRONOUS flag. Clients of asynchronous monikers should always prepare for this possibility. Specifically, it is important for avoiding memory leaks to make sure to release the pointer returned a call to either method.

One way to deal with this case is to call your own implementation of IBindStatusCallback::OnDataAvailable or IBindStatusCallback::OnObjectAvailable in order to use the same code path regardless of whether you bind synchronously or asynchronously.)

See Also

BINDF, BINDINFO, RegisterBindStatusCallback