Functions | |
INT16 | message_pump (void) |
INT16 | key_message_pump (void) |
void | pump_delay (UINT32 delay) |
INT16 key_message_pump | ( | void | ) |
Similar to message_pump()
, but only processes keypresses. This may help reduce latency.
INT16 message_pump | ( | void | ) |
Almost all experiments must run in a deterministic fashion, executing sequentially and in loops instead of the traditional Windows event-processing model. However, Windows messages must still be dispatched for keyboard input and other events. Calling getkey()
will dispatch messages and return keys. The message_pump()
function also dispatches messages, but does not read the keys. It can also handle messages for a modeless dialog box.
0
normally, 1
if ALT-F4 or CTRL-C pressed, or if terminal_break()
called. Any loops should exit in this case.Example: The following two programs works together to show the use of message_pump()
function. In this case, writes a message to EDF file when the left mouse button is pressed.
Output:
pump_delay()
void pump_delay | ( | UINT32 | delay | ) |
During calls to msec_delay()
, Windows is not able to handle messages. One result of this is that windows may not appear. This is the preferred delay function when accurate timing is not needed. It calls message_pump()
until the last 20 milliseconds of the delay, allowing Windows to function properly. In rare cases, the delay may be longer than expected. It does not process modeless dialog box messages.
delay | Number of milliseconds to delay. |
Example:
msec_delay()
and message_pump()