Jump to content

WinQuerySysColor: Difference between revisions

From EDM2
Created page with "This function returns the system color. ==Syntax==  WinQuerySysColor(hwndDesktop, clr, lReserved) ==Parameters== ;hwndDesktop (HWND) - Input : Desktop-window handle. :;HWND_DESKTOP ::The desktop-window handle :;Other ::Specified desktop-window handle. ;clr (LONG) - Input : System color-index value. : Must be one of the SYSCLR_* index values. ;lReserved (LONG) - Input : Reserved value, must be 0. ==Returns== ;lRgbColor (LONG) - returns :RGB value. : RG..."
 
Line 203: Line 203:


==Example Code==
==Example Code==
This example uses the WinQuerySysColor to find the RGB index of the system push button, SYSCLR_BUTTONDEFAULT.
#define INCL_WINSYS
<PRE>
<PRE>
#define INCL_WINSYS
#define INCL_WINSYS

Revision as of 17:57, 9 April 2025

This function returns the system color.

Syntax

 WinQuerySysColor(hwndDesktop, clr, lReserved)

Parameters

hwndDesktop (HWND) - Input
Desktop-window handle.
HWND_DESKTOP
The desktop-window handle
Other
Specified desktop-window handle.
clr (LONG) - Input
System color-index value.
Must be one of the SYSCLR_* index values.
lReserved (LONG) - Input
Reserved value, must be 0.

Returns

lRgbColor (LONG) - returns
RGB value.
RGB (red-green-blue) RGB value corresponding to the Template:Hp1 parameter.

Remarks

This function returns the color value that corresponds to the specified color index of the specified color palette. The following are the available SYSCLR_* values&colon.

System Color Indices and Default RGB Values
System Color Index Default Color Default RGB Values
SYSCLR_ACTIVEBORDER Pale yellow 255 255 128
SYSCLR_ACTIVETITLE Teal 64 128 128
SYSCLR_ACTIVETITLETEXT White 255 255 255
SYSCLR_ACTIVETITLETEXTBGND Teal 64 128 128
SYSCLR_APPWORKSPACE Off-white 255 255 224
SYSCLR_BACKGROUND Light gray 204 204 204
SYSCLR_BUTTONDARK Dark gray 128 128 128
SYSCLR_BUTTONDEFAULT Black 0 0 0
SYSCLR_BUTTONLIGHT White 255 255 255
SYSCLR_BUTTONMIDDLE Light gray 204 204 204
SYSCLR_DIALOGBACKGROUND Light gray 204 204 204
SYSCLR_ENTRYFIELD Pale yellow 255 255 204
SYSCLR_FIELDBACKGROUND Light gray 204 204 204
SYSCLR_HELPBACKGROUND White 255 255 255
SYSCLR_HELPHILITE Blue green 0 128 128
SYSCLR_HELPTEXT Dark blue 0 0 128
SYSCLR_HILITEBACKGROUND Dark gray 128 128 128
SYSCLR_HILITEFOREGROUND White 255 255 255
SYSCLR_ICONTEXT Black 0 0 0
SYSCLR_INACTIVEBORDER Light gray 204 204 204
SYSCLR_INACTIVETITLE Light gray 204 204 204
SYSCLR_INACTIVETITLETEXT Dark gray 128 128 128
SYSCLR_INACTIVETITLETEXTBGND Light gray 204 204 204
SYSCLR_MENU Light gray 204 204 204
SYSCLR_MENUDISABLEDTEXT Dark gray 128 128 128
SYSCLR_MENUHILITE Black 0 0 0
SYSCLR_MENUHILITEBGND Light grey 204 204 204
SYSCLR_MENUTEXT Black 0 0 0
SYSCLR_OUTPUTTEXT Black 0 0 0
SYSCLR_PAGEBACKGROUND White 255 255 255
SYSCLR_SCROLLBAR Pale gray 192 192 192
SYSCLR_SHADOW Dark gray 128 128 128
SYSCLR_SHADOWHILITEBGND Dark gray 128 128 128
SYSCLR_SHADOWHILITEFGND White 255 255 255
SYSCLR_SHADOWTEXT Dark gray 128 128 128
SYSCLR_TITLEBOTTOM Dark gray 128 128 128
SYSCLR_TITLETEXT White 255 255 255
SYSCLR_WINDOW White 255 255 255
SYSCLR_WINDOWFRAME Dark gray 128 128 128
SYSCLR_WINDOWSTATICTEXT Blue 0 0 128
SYSCLR_WINDOWTEXT Black 0 0 0

Errors

Possible returns from WinGetLastError:

  • PMERR_INVALID_HWND (0x1001) An invalid window handle was specified.
  • PMERR_PARAMETER_OUT_OF_RANGE (0x1003) The value of a parameter was not within the defined valid range for that parameter.

Example Code

This example uses the WinQuerySysColor to find the RGB index of the system push button, SYSCLR_BUTTONDEFAULT.

  1. define INCL_WINSYS
#define INCL_WINSYS
#define INCL_WINDESKTOP
#include <OS2.H>

HAB  hab;
LONG lRgbColor;

lRgbColor = WinQuerySysColor(HWND_DESKTOP,
                             SYSCLR_BUTTONDEFAULT,
                             0L);

Related Functions