Posted: 23rd Feb 2003 18:49
I found this around for VB and converted to the DBP code.
I'm using this conversion on my windows,menu system.

Using this code you can get the windows defined colors like background, active menu bar ecc...


remstart
REFERENCE CHART
---------------
ACTIVEBORDER = 10
ACTIVECAPTION = 2
APPWORKSPACE = 12
BACKGROUND = 1
BTNHIGHLIGHT = 20
BTNSHADOW = 16
CAPTIONTEXT = 9
INACTIVEBORDER = 11
INACTIVECAPTION = 3
INACTIVECAPTIONTEXT = 19
MENU = 4
MENUTEXT = 7
SCROLLBAR = 0
WINDOW = 5
WINDOWTEXT = 8
remend

GLOBAL Red,Green,Blue INTEGER

` Variable between brachets is taken from the chart above
` in this case it takes to windows Background color
if GetSysColor(1)=0 then end

cls rgb(Red,Green,Blue)
wait key

Function GetSysColor(colourIndex)

load dll "user32.dll",1
lngColour = call dll(1,"GetSysColor",colourIndex)
delete dll 1

RED_MASK = 255
GREEN_MASK = 65280
BLUE_MASK = 16711680
MAX_COLOUR = 16777215

if (lngColour > Max_Colour) or (lngColour
Posted: 23rd Feb 2003 18:51
Second try:

I found this around for VB and converted to the DBP code.
I'm using this conversion on my windows,menu system.

Using this code you can get the windows defined colors like background, active menu bar ecc...

+ Code Snippet
remstart 
REFERENCE CHART
---------------
ACTIVEBORDER = 10
ACTIVECAPTION = 2
APPWORKSPACE = 12
BACKGROUND = 1
BTNHIGHLIGHT = 20
BTNSHADOW = 16
CAPTIONTEXT = 9
INACTIVEBORDER = 11
INACTIVECAPTION = 3
INACTIVECAPTIONTEXT = 19
MENU = 4
MENUTEXT = 7
SCROLLBAR = 0
WINDOW = 5
WINDOWTEXT = 8
remend

GLOBAL Red,Green,Blue INTEGER

` Variable between brachets is taken from the chart above
` in this case it takes to windows Background color
if GetSysColor(1)=0 then end

cls rgb(Red,Green,Blue)
wait key

Function GetSysColor(colourIndex)

load dll "user32.dll",1
lngColour = call dll(1,"GetSysColor",colourIndex)
delete dll 1

RED_MASK = 255
GREEN_MASK = 65280
BLUE_MASK = 16711680
MAX_COLOUR = 16777215

if (lngColour > Max_Colour) or (lngColour < -Max_Colour) then exitfunction 0

Red = (lngColour and RED_MASK)
Green = (lngColour and GREEN_MASK) / 256
BLUE = (lngColour and BLUE_MASK) / 65536

endfunction 1