As with MidiDTask, MidiTask allows an application to initiate a time delayed function call, however with MidiTask, the call is achieved under interruption as soon as falling time is due.
pascal MidiEvPtr MidiTask (TaskPtr MyProc, long date, short refNum, long a1, long a2,long a3);
MyProc
- a TaskPtr, it is the address of the routine to be called.
date
- a 32-bit integer, it is the date at which this call is scheduled.
refNum
- a 16-bit integer, it is the reference number of the application.
a1,a2,a3
- are 32-bit integers left at the userŐs disposal, as arguments to MyProc.
The result, a MidiEvPtr, is a pointer to a typeProcess MidiShare event. The result is NIL if MidiShare run out of memory.
pascal void MyProc (long date, short refNum, long a1, long a2, long a3);
date
- a 32-bit integer, it is the date of the call.
refNum
- a 16-bit integer, it is the reference number of the application.
a1,a2,a3
- are 32-bit integers that can be freely used.
Schedule a function Action() call 1000 ms ahead.
MidiEvPtr myTask; myTask = MidiTask(Action,MidiGetTime()+1000,myRefNum, a1, a2, a3);
The result, in myTask, can be used to test the success of MidiTask. It can also be used by MidiForgetTask to try to "forget" a scheduled task before it happens.