Provide state-of-the-art image capture, screen capture, video capture and audio capture software
Home     Download     Purchase     Support     Contact     View my shopping cart
You are here: ACASystems » ACA Color Picker » FAQ » VC++/WinAPI Color Code

What's VC++/WinAPI Color Code?

Color is an important element in the pictures and images generated by Windows applications. Windows API functions use COLORREF data struct to specify an RGB color:


When specifying an explicit RGB color, the value has the following hexadecimal form:

  • 0xBBGGRR
  • 0x00BBGGRR

The low-order byte contains a value for the relative intensity of red; the second byte contains a value for green; and the third byte contains a value for blue. The high-order byte must be zero. The maximum value for a single byte is 0xFF.

To create a COLORREF color value, you can use the RGB macro. The RGB macro selects a red, green, blue (RGB) color based on the arguments supplied and the color capabilities of the output device.

  BYTE byRed,    // red component of color
  BYTE byGreen,  // green component of color
  BYTE byBlue    // blue component of color

Example codes:

  // Directly use hex color code to create a red COLORREF color value:
  COLORREF t_crMyColor = 0x0000FF;
  HPEN CreatePen(PS_SOLID, 10,t_crMyColor );

  // Use the RGB macro to create a red COLORREF color value
  COLORREF t_crMyColor = RGB(255,0, 0);
  HPEN CreatePen(PS_SOLID, 10,t_crMyColor );

ACA Color Picker Supports for WINAPI Color Code

ACA Color Picker supports for capturing the color value of any screen pixel and displays its value in WinAPI Color Code, you can use it on your source code based Windows API such as VC++. To apply this feature, please do following steps:

  1. Launch ACA Color Picker. If you have not installed ACA Color Picker on your computer, please click here to free download the setup file, and then install it.
  2. Select VC/WinAPI on Format option. the Color List will show the picked colors in Windows API color code format, as it is shown in the following figure:
  3. ACA Color Picker Supports for WINAPI color code

  4. You can also select RGB on Format option. It will show the picked color in RGB format, it can be used by RGB macro, as it is shown in the following figure:
  5. ACA Color Picker Supports for WINAPI color code

Free Trial ACA Color Picker Now | Buy ACA Color Picker Now

See Also

WinAPI Color References

  • Mincrosoft MSDN: Windows Colors

  • Get discount alerts, new product information and technical articles:
    * Get 10% off your first order by joining our mailing list!
    * You may safely unsubscribe at any time!