Registering as a client – Watlow ANAWIN 2 User Manual

Page 136

Advertising
background image

C-4 AnaWin User’s Guide

AnaWin OLE Server

AWNoDownloadRequested (11): No download has been requested or
the status of the latest download has already been read.

AWDownloadSuccessful (12): Download successful.

AWDownloadFailed (3): Download failed.

Once the status of a download has been obtained, subsequent calls to
RecipeLoadStatus will return AWNoDownloadInRequested (11).

Registering as a Client

RegisterAsClient(clientObj as Object)

UnRegisterAsClient(Clientkey as Integer)

The AnaWin OLE server allows (and encourages) clients to register
themselves so that AnaWin can keep track of them. This allows
AnaWin to notify clients when a local user shuts it down. Once the local
user has shut AnaWin down, AnaWin will no longer respond to client
requests with meaningful data. All queries will be responded to with the
value AWShutDown (1). However, AnaWin cannot completely shut
down until all references are relinquished.

The RegisterAsClient and UnRegisterAsClient methods allow AnaWin
to notify all clients when a user has shut it down, so they can relinquish
their references to the server and it can shut down. Note that if a user
shuts down AnaWin, it cannot be restarted until all clients have closed
their references to it.

To use the registration facility, the client must pass an object that
exposes a ShutDown method that AnaWin may call when it is shut
down to the RegisterAsClient function. RegisterAsClient returns a long
integer value that the client can save as its client ID. If the client wishes
to shut down before AnaWin shuts down, it should call the
UnRegisterAsClient method, passing the client ID value, then close its
reference to the server.

The client’s shutdown method should immediately close its reference to
the server.

WARNING

The client should not call UnRegisterAsClient from its
ShutDown method, as this will cause an OLE deadlock sit-
uation where each process is waiting for the other to return
from its message call.

Advertising