Obtain Windows Appearance Settings?

BlitzMax Forums/BlitzMax Programming/Obtain Windows Appearance Settings?

Is there a way to obtain the windows appearance settings programmatically?

I mean such things as:

- Message box font & size
- Menu color
- etc.

In particular, I'm trying to blend in a canvas with a MaxGUI window, but want to make sure that the background color I pick for the canvas is the same as whatever windows is configured to use.

I would imagine that these could be obtained through the registry, take a look on MSDN.

Yessss.... Managed to get the colors on my own. Not sure about fonts & sizes yet.

Import "-luser32"

Extern "win32"
	Function GetSysColor:Int(index) =  "GetSysColor[AT-SYMBOL]4"
' !!! REPLACE [AT-SYMBOL] with a normal @ sign !!!
End Extern

Const COLOR_SCROLLBAR = 0
Const COLOR_BACKGROUND = 1
Const COLOR_ACTIVECAPTION = 2
Const COLOR_INACTIVECAPTION = 3
Const COLOR_MENU = 4
Const COLOR_WINDOW = 5
Const COLOR_WINDOWFRAME = 6
Const COLOR_MENUTEXT = 7
Const COLOR_WINDOWTEXT = 8
Const COLOR_CAPTIONTEXT = 9
Const COLOR_ACTIVEBORDER = 10
Const COLOR_INACTIVEBORDER = 11
Const COLOR_APPWORKSPACE = 12
Const COLOR_HIGHLIGHT = 13
Const COLOR_HIGHLIGHTTEXT = 14
Const COLOR_BTNFACE = 15
Const COLOR_BTNSHADOW = 16
Const COLOR_GRAYTEXT = 17
Const COLOR_BTNTEXT = 18
Const COLOR_INACTIVECAPTIONTEXT = 19
Const COLOR_BTNHIGHLIGHT = 20
Const COLOR_3DDKSHADOW = 21
Const COLOR_3DLIGHT = 22
Const COLOR_INFOTEXT = 23
Const COLOR_INFOBK = 24

Local red:Int
Local green:Int
Local blue:Int

bgcolor=GetSysColor(Color_Menu)

red = bgcolor & $FF
green =  (bgcolor & $FF00) Shr 8
blue = (bgcolor & $FF0000) Shr  16 

Print red+","+green+","+blue



This sample will print the menu red, green and blue values, which are the same as the normal background panel. See the definitions at the top to find the other color items.

Aargh -- looks like the forum is messing up the code, adding mailto: references around the @ in the function declaration. Read source for fix.