TE Edit Control Win32 / Win64 Help
Product page

TerGetTextColor

Get the foreground and background colors for the specified font id.

BOOL TerGetTextColor(hWnd, FontId, TextColor, TextBkColor)
HWND hWnd;The handle of the window to be accessed
int FontId;

The editor font id to retrieve color. A valid font id would a value between 0 and TotalFonts - 1.

You can also use this function to get the text color for a stylesheet item by specifying the style id as a negative value for this parameter. Also, use the following constant to specify normal or the current style item:

SID_NORMAL:Normal style item
SID_CUR:Style item being current edited
LPDWORD TextColor;pointer to a double word location to receive the text foreground color.
LPDWORD TextBkColor;pointer to a double word location to receive the text background color.

Return Value: This function returns TRUE when successful.

Example:

// This example retrieves the text foreground and background color for font id: 0.

COLORREF TextColor, TextBkColor;

TerGetTextColor(hWnd,0,&TextColor,&TextBkColor);