Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to always have the same color?
Message
De
24/11/1999 09:30:48
 
 
À
24/11/1999 09:09:19
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00294757
Message ID:
00294980
Vues:
22
>Hello Ed,
>
>>You can extract RGB values from the Win32 API - you may want to look at GetNearestColor() and GetSystemPaletteEntries() as tools to extract values from
>the user's system color scheme.
>
>Could you give more details on how to accomplish this?

GetSystemPaletteEntries() returns a pointer to an array of PALETTEENTRY structures, starting at a relative offset for a specified number of entries on the system palette. Each palette entry contains R, G and B values that can be fed to VFP. The API call is decalred in VFP as follows:

DECLARE INTEGER GetSystemPaletteEntries IN WIN32API ;
INTEGER hdc, ;
INTEGER uStartIndex, ;
INTEGER uEntries, ;
STRING @ LPAPALETEENTRY

You'll need to get the device context of the screen using CreateDC() to get the hDC (device context handle, an integer), and you'll need to preallocate a string variable at least as large as uEntries * the size of a PALETTEENTRY structure. You'd call it passing in the hdc, the start position in the system palette (0 is a good place to start), the number of entries to return and the preallocated string variable, which must be passed by reference (prefix the variable with an @). You then wander through the returned array pulling out the R, G and B values you want.

I don't have the strucutres here in front of me, but they're documented in the MSDN library docs, also available on MSDN OnLine.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform