Export (0) Print
Expand All

IMoniker::Hash method

Creates a hash value using the internal state of the moniker.

Syntax


HRESULT Hash(
  [out]  DWORD *pdwHash
);

Parameters

pdwHash [out]

A pointer to a variable that receives the hash value.

Return value

This method returns S_OK to indicate that the hash value was retrieved successfully.

Remarks

Notes to Callers

You can use the value returned by this method to maintain a hash table of monikers. The hash value determines a hash bucket in the table. To search such a table for a specified moniker, calculate its hash value and then compare it to the monikers in that hash bucket using IMoniker::IsEqual.

Notes to Implementers

The hash value must be constant for the lifetime of the moniker. Two monikers that compare as equal using IMoniker::IsEqual must hash to the same value.

Marshaling and then unmarshaling a moniker should have no effect on its hash value. Consequently, your implementation of IMoniker::Hash should rely only on the internal state of the moniker, not on its memory address.

Implementation-specific Notes

ImplementationNotes
Anti-monikerThis method calculates a hash value for the moniker.
Class monikerThis method calculates a hash value for the moniker and returns S_OK. May return E_INVALIDARG if pdwHash is an invalid pointer.
File monikerThis method calculates a hash value for the moniker.
Generic composite monikerThis method calculates a hash value for the moniker.
Item monikerThis method calculates a hash value for the moniker.
OBJREF monikerThis method calculates a hash value for the moniker.
Pointer monikerThis method calculates a hash value for the moniker.
URL monikerCreates a hash value based on the URL string of the moniker. This hash value is identical when URL strings are identical, although it may also be identical for different URL strings. This method is used to speed up comparisons by reducing the amount of time that it is necessary to call IMoniker::IsEqual.

 

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

ObjIdl.h

IDL

ObjIdl.idl

IID

IID_IMoniker is defined as 0000000f-0000-0000-C000-000000000046

See also

IMoniker

 

 

Community Additions

ADD
Show:
© 2014 Microsoft