beautypg.com

Apple AppleShare 3.0 File Server Controls User Manual

Page 41

background image

{ Your application calls RemoveServerEventHandler to }

{ remove the server event handler and dispose of the }

{ memory allocated by InitSEQEntry (which is called by }

{ InstallServerEventHandler). }

FUNCTION RemoveServerEventHandler: OSErr;

BEGIN

{ Remove the server event handler. }

RemoveServerEventHandler :=

mySCRemoveServerEventProc(@gExtendedSEQEntry);

{ Get rid of memory used for the server event records. }

IF gExtendedSEQEntry.seRecArrayPtr <> NIL THEN

DisposPtr(gExtendedSEQEntry.seRecArrayPtr);

END;

END. { ServerEventHandler unit }

Application event loop

The heart of any Macintosh program is the event loop, which causes the

application to wait for an event -- such as a user's attempt to choose a menu

item or open a file. When an event occurs, the application can respond

accordingly.

The following sample code shows an application event loop that processes the

server events announced by a server event handler.

REPEAT

IF WaitNextEvent(everyEvent, event, sleep, cursorRgn) THEN

DoEvent(event); {process toolbox events}

ProcessServerEvents; {process server events}

UNTIL quitFlag;

_____________________________________________________________________________

CHAPTER 3

_____________________________________________________________________________

SERVER CONTROL CALL REFERENCE

This chapter provides detailed information about each of the AppleShare File

Server 3.0 server control calls. This chapter gives a brief description of

each call, shows the structure of the parameter block, describes each field