Condividi tramite


Funzione RoRegisterForApartmentShutdown (roapi.h)

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

Sintassi

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

Parametri

[in] callbackObject

Interfaccia IApartmentShutdown fornita dall'applicazione.

[out] apartmentIdentifier

Identificatore per l'appartamento 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 .

Commenti

Per ricevere notifiche di arresto dell'appartamento, l'app deve registrare il gestore di arresto dell'appartamento con il sistema chiamando la funzione RoRegisterForApartmentShutdown .

Avviso  
 
Non chiamare la funzione RoRegisterForApartmentShutdown dal callback OnUninitialize .

Requisiti

Requisito Valore
Client minimo supportato Windows 8 [app desktop | App UWP]
Server minimo supportato Windows Server 2012 [app desktop | App UWP]
Piattaforma di destinazione Windows
Intestazione roapi.h
Libreria RuntimeObject.lib
DLL ComBase.dll

Vedi anche

IApartmentShutdown

RoUnregisterForApartmentShutdown