Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ColorRGBToHLS Function usage

Status
Not open for further replies.

mhartman1

Technical User
May 5, 2006
155
0
0
Hello: Can anyone tell me the correct way to call the following API function:

Public Declare Function ColorRGBToHLS Lib "shlwapi.dll" (ByVal clrRGB As Long,
pwHue As Long, pwLuminance As Long, pwSaturation As Long) As Long

As a start, what is the "clrRGB" expecting? a hex value maybe? Or does a special word have to be assemble for this parameter?

Also, I am assuming that the pwHue, pwLuminance and pwSaturation paramenters are the values being returned, but I cannot get past the "clrRgb" part

Many thanks in advance
Mark
 
clrRGB is the RGB color value. It's simply a long integer which holds a 24-bit color value (R, G, B) in lower 3 bytes. You can pass a color as a long integer, or use hex representation. For instance, the RGB value of red is 255 (&H0000FF&) and that of yellow is 65535 (&H00FFFF&).

You can pass color values from various sources, including:
[ul][li] A color returned by VB's RGB function.[/li]
[li] A 'ColorConstant' (vbBlue, vbMagenta, vbGreen etc.)[/li]
[li] A color returned by VB's Point method (Form.Point, PictureBox.Point)[/li]
[li] A color returned by the Color property of the Common Dialog Box.[/li]
[li] A color returned by an API function, for example, GetPixel function.[/li][/ul]

You cannot pass a 'SystemColorConstant' like 'vbButtonFace'.

A keyword search in this forum will lead you to at least following two threads.
thread222-1094943
thread222-1156289
 
Thanks Hypetia for taking the time to respond. This has helped me very much.

Kind regards
Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top