Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / short API code to get Windows System Colors

Author
Message
turchino
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Italy
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
turchino
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Italy
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...

Login to post a reply

Server time is: 2024-11-24 04:51:22
Your offset time is: 2024-11-24 04:51:22