Programming Considerations for Message Handlers

While the handler is executing, the router pauses while waiting, and messages can transmit to the radio device. Because a radio device has little memory, it relies on being able to transfer incoming data to a Windows CE–based device before its buffer is full. The code must be written in such a way that the handler returns as quickly as possible. Because the router does not invoke message handlers in separate threads, handlers must not block.

A message handler should not attempt to interact with a user. Instead, it can store a message in a queue, handle the message in real time, or execute an application program in a separate thread.

A message handler should perform all data conversions, including those required for internationalization, such as converting from ASCII to Unicode characters. This ensures that any application to which the message handler passes data does not have to convert between different formats.