Surface Uniqueness Values

The uniqueness value of a surface allows you to determine whether the surface has changed. When DirectDraw creates a surface, it assigns a uniqueness value, which you can retrieve and store by using the IDirectDrawSurface5::GetUniquenessValue method. Then, whenever you need to determine whether the surface has changed, you call the method again and compare the new value against the old one. If it is different, the surface has changed.

The actual value returned by GetUniquenessValue is irrelevant, unless it is 0. DirectDraw assigns this value to a surface when it knows that the surface might be changed by some process beyond its control. When GetUniquenessValue returns 0, you know only that the state of the surface is indeterminate.

To force the uniqueness value for a surface to change, an application can use the IDirectDrawSurface5::ChangeUniquenessValue method. This method could be called, for example, by an application or component that changed the private data for a surface without changing the surface itself, and wanted to notify some other process of the change. Most applications, however, never need to change the uniqueness value.

© 1992-2003 Microsoft Corporation. All rights reserved.