How to tell if color device?

How can my program tell if it's running on a color device?

Depends on the version of the devices you must support.

Before 3.0, the operating system only supported black and white. To access greyscale mode, you had to write to hardware registers directly.

Between 3.0 and 3.5, you'd use the function 'ScrDisplayMode'. The operating system did not support much color functionality, but there was a little bit.

In 3.5 devices and beyond, you can call WinScreenMode() to find either all the supported color depths on the device, or whether any kind of "color" mode is supported:

 

            Err err;
UInt32 supportedDepths;
Boolean supportsColor;

err = WinScreenMode(winScreenModeGetSupportedDepths, NULL, NULL,
&supportedDepths, NULL);

err = WinScreenMode(winScreenModeGetSupportsColor, NULL, NULL,
NULL, &supportsColor);

Note that Sony, Handspring, Handera and Palm all brought out different API's for higher resolution screens under OS 3.x and OS4.x. Please refer to the documentation from the particular Vendor you wish to support.

After OS 5.0, there's a common API for high-resolution graphics that all devices should support. Refer to the Palm OS5.0 SDK documentation for more information.

Today: Sep 8, 2010