Compartilhar via


IAgentTransportShutdownCallback::desligado

Os agentes do lado do dispositivo dá uma chance para executar Limpar e sair.

HRESULT Shutdown([in] IUnknown *in_pUnknown)

Parâmetros

  • in_pUnknown
    Cookie de interface de IUnknown

Valor de retorno

An HRESULT valor que indica o resultado da telefonar do método.

  • S_OK | telefonar esta API foi bem-sucedida.

  • E_FAIL | retornar o valor para qualquer Outros falha.

Comentários

Para registrar o objeto de retorno de chamada, use IDeviceAgentTransport::RegisterShutdownCallback.

Exemplo

O exemplo a seguir define uma implementação personalizada de IAgentTransportShutdownCallback. For the complete example, see IDeviceAgentTransport.

// Custom implementation of IAgentTransportShutdownCallback
class MyShutdownCallback: public IAgentTransportShutdownCallback
{
private:
    long ref;
public:
    HRESULT STDMETHODCALLTYPE Shutdown(IUnknown *in_pUnknown) 
    {
        // Add your cleanup code here 
        MessageBox(NULL,_T("conmanclient2 exited"),_T("conmanclient exited"),0);
        return 0;
    }

    // Must implement members from IUnknown
    HRESULT STDMETHODCALLTYPE QueryInterface( REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject)
    {
        return 0;
    }
    ULONG STDMETHODCALLTYPE AddRef( void)
    {
        return InterlockedIncrement(&ref);
    }

    ULONG STDMETHODCALLTYPE Release( void)
    {
        if(InterlockedDecrement(&ref) == 0)
        {
            delete this;
            return 0;
        }
        return ref;
    }
};

Equivalente gerenciado

IAgentTransportShutdownCallback.Shutdown

Requisitos

DeviceAgentTransport.h

Consulte também

Referência

IAgentTransportShutdownCallback