IDeviceAgentTransport::RegisterShutdownCallback

Mise à jour : novembre 2007

Enregistre un rappel pour recevoir une notification avant l'arrêt de l'agent.

HRESULT RegisterShutdownCallback([in] IAgentTransportShutdownCallback *in_pCallback, [in] IUnknown *in_pUnknown)

Paramètres

  • in_pCallback
    L'objet devant recevoir la notification d'arrêt. L'objet doit implémenter IAgentTransportShutdownCallback.

  • in_pUnknown
    Cookie d'interface à passer en tant que paramètre à la routine de rappel.

Valeur de retour

Valeur HRESULT qui indique le résultat de l'appel de méthode.

Notes

Un agent est arrêté lorsque l'ordinateur de bureau effectue un arrêt explicite ou lorsque conmanclient2.exe est arrêté en exécutant clientshutdown.exe. Un agent Smart Device peut demander à recevoir une notification d'arrêt pour effectuer un nettoyage et quitter normalement. Pour recevoir une notification d'arrêt, l'agent Smart Device doit définir une classe qui implémente IAgentTransportShutdownCallback, puis l'enregistrer à l'aide de cette méthode.

Exemple

Cet exemple enregistre un objet de rappel d'arrêt personnalisé auprès de l'agent Smart Device. Pour accéder à l'intégralité de l'exemple, consultez la rubrique IDeviceAgentTransport.

// Register the callback with the Device Agent Transport
MyShutdownCallback *shutdownCallback = new MyShutdownCallback();
pTransport->RegisterShutdownCallback(shutdownCallback,shutdownCallback);

Équivalent managé

IDeviceAgentTransport.RegisterShutdownCallback

Configuration requise

DeviceAgentTransport.h

Voir aussi

Référence

IDeviceAgentTransport