Stupid C question

From: Richard A. Cini <rcini_at_optonline.net>
Date: Thu Sep 16 19:58:22 2004

Hello, all:

        OK, here's where my lack of intimate knowledge of C shows. I'm
working on a graphics board add-in for the Altair32 Emulator. I have 16 of
the following declarations, one for each color supported by the board:

        const COLORREF colGray = RGB(128,128,128) ; // 8

        The RGB macro converts an RGB color value to a different datatype (a
DWORD) for use with various Windows APIs, such as the one I'm using to draw
color boxes. The colors are in order per the video board docs, so I create
an array of COLORREFs:

        static COLORREF colColors[] = {colGray, colMaroon, colNavy,
colPurple,
                                                colGreen, colOlive, colTeal,
colSilver,
                                                colBlack, colRed, colBlue,
colMagenta,
                                                colLime, colYellow, colCyan,
colWhite} ;

        This array is used with a nybble from system memory to create the
drawing brush for the FillRect call:

        firstbyte = HINYBBLE(screenbyte) ;
        hbr=(HBRUSH)CreateSolidBrush(colColors[firstbyte]) ;
        FillRect(hdc, &rc, hbr) ; // hdc and rc declared earlier


        Now, here's the problem. I get compiler error C2099 on the
declaration of colColors. C2099 translates to "initializer is not a
constant". I'm sure that the solution is something obvious to the
trained eye, but I'm not seeing it. Can someone identify what I'm missing?

        Thanks.

Rich

Rich Cini
Collector of classic computers
Build Master for the Altair32 Emulation Project
Web site: http://highgate.comm.sfu.ca/~rcini/classiccmp/
/************************************************************/
Received on Thu Sep 16 2004 - 19:58:22 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:37:29 BST