Annotation Properties That Have Corresponding WinEvents

Be careful when overriding properties that change frequently, particularly those that are examined by clients as a result of a WinEvent (such as State, Value, and, for some controls, the Name properties).

In many cases, especially for USER and ComCtl controls, the WinEvent signaling a property change is sent before the owner of the control is notified (typically via WM_NOTIFY). Updating the property using SetPropValue in the WM_NOTIFY handler will be too late; clients using in-context hooking will already have accessed the old value.

You can handle these types of properties by using callback server objects (using SetPropServer); however, the server cannot use any state that is updated in the WM_NOTIFY handler because that handler will not yet have been called. For example, instead of using a cached current value variable that is updated in the WM_NOTIFY handler and will be out-of-date, the IAccPropServer::GetPropValue callback object should send a message directly to the control to get its true current value to generate the required property.