NMInstall
NMInstall Add a notification request to the notification queue NMRec nmReqPtr ; pointer to a request procedure returns 0= noErr
NMInstall adds a notification request to the notification queue. nmReqPtr is a pointer to an NMRec data structure. Returns: an error code. It will be one of: noErr (0) No error
nmTypErr (-299) Wrong qType (must be 8)
Notes: NMInstall neither moves nor purges memory and you can call it from completion routines, interrupt handlers, the main body of an application
program and from the response procedure of a notification request
The system automatically initializes the Notification Manager when it
boots. You call NMInstall when you want to add a request to the queue. However, before calling NMInstall, you need to see if your application is running in the background. If it is, make this call to install the notification
event.
err = NMInstall ((NMRecPtr) &myNote);
If your application is in the foreground, Notification Manager generally
isn't needed.
If NMInstall returns an error, you can't install the notification event. Wait for the user to switch your application to the foreground before
proceeding with anything else. If you installed the notification successfully,
make sure you remove it with code like this when your application is
switched back into the foreground:
If you do not yet have glue for NMInstall, you can use the following: FUNCTION NMInstall (nmReqPtr: QElemPtr) : OSErr; NLINE 0x205F, 0xA05E, 0x3E80;
Also note that qType must be set to ORD(nmType), which is 8.
The following short code segments demonstrate the use of the Notification
Manager in C:
#include <OSUtils.h>
Handle ManDoneS; //declare a handle for the sound OSErr err; //declare for err handling myNote.qType = nmType; //queue type -- nmType = 8
myNote.nmMark = 1; //get mark in Apple menu
myNote.nmIcon = nil; //no flashing Icon
//get the sound you want out of your resources
myNote.nmSound = ManDoneS; //set the sound to be played
myNote.nmStr = nil; //no alert box myNote.nmResp = nil; //no response procedure
myNote.nmRefCon = nil; //nil since don't need my A5