home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-12 | 1.9 KB | 85 lines | [TEXT/R*ch] |
- /* NAME:
- NotifyMsg.c
-
- WRITTEN BY:
- Dair Grant
-
- DESCRIPTION:
- Displays a Notification Manager dialog with a specific string.
-
- ___________________________________________________________________________
- */
- //=============================================================================
- // Include files
- //-----------------------------------------------------------------------------
- #include <Memory.h>
- #include <TextUtils.h>
- #include <Notification.h>
- #include <Traps.h>
- #include "NotifyMsg.h"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- //=============================================================================
- // NotificationMessage : Post a Notification Manager request.
- //-----------------------------------------------------------------------------
- // Note : The NM Record is left in the System Heap.
- //-----------------------------------------------------------------------------
- pascal void NotificationMessage(short theStrings, short theStr)
- { NMRec *theNote;
- short strLen;
- Str255 errorStr;
-
-
-
-
- // Test for the Notification Manager. If we don't have it, just beep
- if (NGetTrapAddress(_NMInstall, OSTrap) == NGetTrapAddress(_Unimplemented, ToolTrap))
- SysBeep(30);
-
-
- // Otherwise, install the request
- else
- {
- // Allocate and initialise a new NMRec structure
- theNote = (NMRec *) NewPtrSys(sizeof(NMRec));
- if (theNote)
- {
- // Initialise the note structure
- theNote->qType = nmType;
- theNote->nmMark = 0;
- theNote->nmIcon = 0;
- theNote->nmSound = (Handle) -1;
- theNote->nmResp = (NMProcPtr) nil;
-
-
- // Put the text into the note and post it
- GetIndString(errorStr, theStrings, theStr);
- strLen = errorStr[0] + 1;
- theNote->nmStr = (StringPtr) NewPtr(strLen);
- if (theNote->nmStr != nil && errorStr[0] == 0)
- {
- DisposPtr((Ptr) theNote);
- theNote = nil;
- }
- else
- {
- BlockMoveData(errorStr, theNote->nmStr, strLen);
- NMInstall(theNote);
- }
- }
- }
- }
-