Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I detemine the Windows Color Settings
Message
From
21/09/1998 19:46:53
 
 
To
21/09/1998 15:41:00
Tom Kreinbring
Thomas Kreinbring & Associates
Temple City, California, United States
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00139212
Message ID:
00139320
Views:
23
>I need to determine the Windows Control Panel Settings for the Selected Item Back & Fore Colors? How do I do it?

Hi Tom - I added this code to the Registry.prg that came with vfp:
DEFINE CLASS colorreg AS registry
	FUNCTION GetRGB
		LPARAMETERS cItem, nR, nG, nB		&& pass colors by reference
		* eg eNum= o.GetRGB("Hilight", @m.nR, @m.nG, @m.nB)
		LOCAL cRGB, nRetVal
		cRGB= ""
		nRetVal= THIS.GetRegKey(m.cItem, @cRGB, "Control Panel\Colors", HKEY_CURRENT_USER)
		nR= INT(VAL(m.cRGB))
		nG= INT(VAL(SUBSTR(m.cRGB, AT(" ", m.cRGB)+1)))
		nB= INT(VAL(SUBSTR(m.cRGB, RAT(" ", m.cRGB)+1)))
		RETURN m.nRetVal
	ENDFUNC

	FUNCTION ColorValue
		LPARAMETER cItem
		* eg myColor= o.ColorValue("Hilight")
		LOCAL nR, nG, nB
		IF THIS.GetRGB(m.cItem, @m.nR, @m.nG, @m.nB) = ERROR_SUCCESS
			RETURN RGB(m.nR, m.nG, m.nB)
		ELSE
			RETURN 0	&& black
		ENDIF
	ENDFUNC

ENDDEFINE
You can then do:
o=CreateObject("ColorReg")
myColour= o.ColorValue("activetitle")

This allows me to tailor colors of things like refreshable labels to the users color settings
HTH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform