home *** CD-ROM | disk | FTP | other *** search
- DECLARE SUB ProgramBody ()
- '***************************************************************************
- '*
- '* Name: Receive
- '*
- '* Function: Receive Mailbox
- '*
- '***************************************************************************
-
- ' $INCLUDE: 'dvapi.bi'
-
- ' minimum API version required and actual API version
- CONST required = &H201
-
- DIM version AS INTEGER
- ' Object handles
- DIM SHARED win&, kbd&, malhan&
-
- ' Variables used when reading the menu keyboard
- DIM SHARED kbuf$, selfield%
-
-
- '***************************************************************************
- ' Main Module - check for DESQview present and enable required extensions
- '***************************************************************************
-
- ' Initialize DESQview interface and get API version number
- version = ApiInit%
-
- ' If DESQview is not running or version is too low, display a message
- IF version < required THEN
- OPEN "CONS:" FOR OUTPUT AS 1
- PRINT #1, USING "This program requires DESQview version #.##"; required \ 256 + (required MOD 256) / 100
- CLOSE 1
- ELSE
- ' Tell DESQview what extensions to enable and start application
- CALL ApiLevel(required)
- CALL ProgramBody
- END IF
-
- ' Disable DESQview interface and return from program
- CALL ApiExit
-
- SUB ProgramBody
- '***************************************************************************
- ' ProgramBody - build menu and display message when item selected
- '***************************************************************************
- Attempt! = 0
- OPEN "Cons:" FOR OUTPUT AS #1
- '
- ' First, get our Mailbox Handle
- '
- malhan& = MalMe&
- '
- ' Assign global name "Receive"
- '
- CALL MalName(malhan&, "Receive")
- '
- ' Look for the Receive mailbox; loop until found
- '
- Find: SendHan& = MalFind&("Send")
- IF SendHan& = 0 THEN
- PRINT #1, "<NODE NOT FOUND>";
- GOTO Find
- END IF
- '
- ' At this point, SendHan& is mailbox of receiver
- '
-
- '
- ' Get the message from send module
- '
- Talk: Message$ = MalRead$(malhan&)
- PRINT #1, "<RECEIVED SEND -" + Message$ + ">"
- Attempt = Attempt + 1
- msg$ = STR$(Attempt)
- PRINT #1, "<SEND RECEIPT>";
- errstat% = MalWrite%(SendHan&, msg$)
- IF errstat > 0 THEN
- ' Error handling would go here
- END IF
- GOTO Talk
-
-
-
-
-
-
- END SUB
-
-