Funzione RoRegisterForApartmentShutdown (roapi.h)

Registra un callback IApartmentShutdown da richiamare quando l'apartment corrente viene chiuso.

Sintassi

HRESULT RoRegisterForApartmentShutdown(
  [in]  IApartmentShutdown                     *callbackObject,
  [out] UINT64                                 *apartmentIdentifier,
  [out] APARTMENT_SHUTDOWN_REGISTRATION_COOKIE *regCookie
);

Parameters

[in] callbackObject

Interfaccia IApartmentShutdown fornita dall'applicazione.

[out] apartmentIdentifier

Identificatore dell'apartment corrente.

[out] regCookie

Cookie che è possibile usare per annullare la registrazione del callback.

Valore restituito

Se questa funzione ha esito positivo, restituisce S_OK. In caso contrario, restituisce un codice di errore HRESULT.

Remarks

L'oggetto che implementa l'interfaccia IApartmentShutdown deve essere agile.

Il callback OnUninitialize viene chiamato nel contesto dell'appartamento che sta chiudendo.

Il callback viene annullata automaticamente la registrazione dopo che viene richiamata.

Avviso  
 
Non chiamare la funzione RoRegisterForApartmentShutdown dal callback OnUninitialize .

Requirements

Requirement Value
Client minimo supportato Windows 8 [app desktop | App UWP]
Server minimo supportato Windows Server 2012 [app desktop | App UWP]
Piattaforma di destinazione Windows
Header roapi.h
Library RuntimeObject.lib
DLL ComBase.dll

Vedere anche

IApartmentShutdown

RoUnregisterForApartmentShutdown