| Mac OS X header: | Carbon/Carbon.h |
| Mac OS 9 header: | URLAccess.h |
| Miscellaneous Callbacks | |
| URLNotifyProcPtr | Your notification callback function handles certain data transfer events that occur during data transfer operations. |
| URLSystemEventProcPtr | Your callback handles update events that occur while a dialog box is displayed during a data transfer operation. |
URLNotifyProcPtr |
Defines a pointer to your notification callback function.
Your notification callback function handles certain data transfer events that occur during data transfer operations.
typedef OSStatus(* URLNotifyProcPtr) (
void *userContext,
URLEvent event,
URLCallbackInfo *callbackInfo
);
If you name your function MyURLNotifyCallback, you would declare it like this:
OSStatus MyURLNotifyCallback (
void *userContext,
URLEvent event,
URLCallbackInfo *callbackInfo
);
A pointer to application-defined storage that your application previously passed to the function URLOpen. Your application can use this to set up its context when your notification callback function is called.
The data transfer event that your application wishes to be notified of. See Data Transfer Event Constants for a description of possible values. The type of event that can trigger your callback depends on the event mask you passed in the eventRegister parameter of the function URLOpen, and whether you pass a valid file specification in the fileSpec parameter of URLOpen. For more information, see the discussion.
A pointer to a structure of type URLCallbackInfo. On return, the structure contains information about the data transfer event that occurred. The URL Access Manager passes this information to your callback function via the callbackInfo parameter of the function InvokeURLNotifyUPP.
A result code. Your notification callback function should process the data transfer event and return noErr.
Your notification callback function handles certain data transfer events that occur during data transfer operations performed by the function URLOpen. You can define an event notification function and the events for which you want to receive notification only if you do not specify a file in which to store the data for download operations. In order to be notified of these events, you must pass a UPP to your notification callback function in the notifyProc parameter. You indicate the type of data transfer events you want to receive via a bitmask in the eventRegister parameter.
Note that if you pass a valid file specification to URLOpen, your callback function will not be notified of data available and transaction completed events as identified by the constants kURLDataAvailableEvent and kURLTransactionCompleteEvent. If you pass a valid file specification to URLOpen, your callback function notified if any of the following events occur: kURLPercentEvent, kURLPeriodicEvent, kURLPropertyChangedEvent, kURLSystemEvent, kURLInitiatedEvent, kURLResourceFoundEvent, kURLDownloadingEvent, kURLUploadingEvent, kURLAbortInitiatedEvent, kURLCompletedEvent, and kURLErrorOccurredEvent.
When your callback is called, it should process the event immediately and return 0. You may wish your callback function to update its user interface, allocate and deallocate memory, or call the Thread Manager function NewThread.
Do not call the function URLDisposeReference from your notification callback function. Doing so may cause your application to stop working.
URLSystemEventProcPtr |
Defines a pointer to your system event notification callback.
Your callback handles update events that occur while a dialog box is displayed during a data transfer operation.
typedef OSStatus(* URLSystemEventProcPtr) (
void *userContext,
EventRecord *event
);
If you name your function MyURLSystemEventCallback, you would declare it like this:
OSStatus MyURLSystemEventCallback (
void *userContext,
EventRecord *event
);
A pointer to application-defined storage that your application previously passed to the function URLSimpleDownload, URLDownload, URLSimpleUpload, or URLUpload. Your application can use this value to set up its context when the system event callback function is called.
A pointer to an event record containing information about the system event that occurred during the data transfer operation.
A result code. Your system event callback function should process the system event and return noErr.
You pass a pointer to your callback function in the eventProc parameter of the function URLSimpleDownload, URLSimpleUpload, URLDownload, or URLUpload if you want update events to be passed to your application while a dialog box is displayed by these functions. (In Mac OS X, this is not necessary, since all dialog boxes are moveable). In order for these functions to display a dialog box, you must set the mask constant kURLDisplayProgressFlag or kURLDisplayAuthFlag in the bitmask passed in the openFlags parameter. Call the function NewURLSystemEventUPP to create a UPP to your system event notification callback. If you do not write your own system event notification callback, these functions will display a nonmovable modal dialog box.
When your callback is called, it should process the event immediately and return 0. You may wish your callback function to update its user interface, allocate and deallocate memory, or call the Thread Manager function NewThread.
Do not call the function URLDisposeReference from your callback function. Doing so may cause your application to stop working.
© 2001 Apple Computer, Inc. (Last Updated July 21, 2001)