# ReturnPreviousControlPad

Returns the state of the control pad as it is remembered.

### Synopsis

`int32 ReturnPreviousControlPad (int32 whichPad)`

### Description

Returns the state of the specified control pad as it is remembered from the last time `DoControlPad()` was called and a new state for the control pad existed.

### Arguments

whichPad
  Index of the control pad to query.

### Return Value

Returns 0 if successful or a negative error code if an error occurs.

### Caveats

This function is neither multi-thread or multi-task capable or safe.

Because of system restrictions on item ownership and using items, ``you should call this function from the task or thread which called `InitControlPad()`.

`InitControlPad()` and `InitEventUtility()` create message ports and message items which only the task which has created them can use. Hence, `DoControlPad()` can only be called by that same task. If other tasks or threads attempt this errors result because those tasks or threads do not own the appropriate message ports and messages.

To make this function multi-thread capable, you would need to spawn a thread that communicates directly with the event broker, and with all the other tasks that will consume event information.

### Associated Files

controlpad.c, controlpad.h

### Location

examples/Exampleslib

### See Also

`InitControlPad`, KillControlPad