MidiDTask


As with MidiTask, MidiDTask allows an application to initiate a time delayed function call, but unlike MidiTask, the call is not achieved under interruption as soon as falling time is due. The address of the routine to be executed and the corresponding arguments are stored in a special buffer. The application can then process these waiting tasks, one by one, using to MidiExec1DTask.

pascal MidiEvPtr    MidiDTask (ProcPtr MyProc, long date, short refNum, long a1, long a2, long a3);


MyProc
is the address of the function 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 typeDProcess MidiShare event. The result is NIL if MidiShare runs 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 Action() procedure call 1000 ms ahead.


MidiEvPtr    myDTask;
MyDTask = MidiDTask(Action,MidiGetTime()+1000,myRefNum, a1, a2, a3);

The result, in myDTask, can be used to test the success of MidiDTask. It can also be used by MidiForgetTask to try to "forget" a scheduled task before it happens.