Discussion:
convert OleColor into RGB
(too old to reply)
Lamberti Fabrizio
2005-04-08 10:21:54 UTC
Permalink
Hi all.

I've got an ActiveX Object that gives me OleColor codes for its graphical
components.

I need to convert these OleColor codes into RGB codes using JScript or
VBScript, becuase I have to using that color inside color style attribute of
some HTML components.

Anyone can help me ?

Thx
Leonhardt Wille
2005-04-08 12:45:51 UTC
Permalink
Hi,
OLE Colors (OLE_COLOR) are stored in a ARGB (alpha-red-green-blue) DWORD
(32-Bit unsigned integer).
If you have written the Object by yourself, you could call
OleTranslateColor to convert the OLE_COLOR to a COLORREF.
A colorref is also a DWORD and has the form 0x00bbggrr.
Although I didn't find any information about OLE_COLOR, I assume that
this DWORD has the form 0xaabbggrr, or 0xaarrggbb.
You could experimentally dump values from your ActiveX object as
hexadecimal integers - i.e. get the Ole_COLOR for red and look at the
result in hex.

To convert the DWORD to single byte values, you have to do the following
(I use the C++ '>>' (right-shift) operator.)
DWORD ole=0x00AABBCC;
BYTE r = ((BYTE)(ole))
BYTE g = ((BYTE)(((WORD)(ole)) >> 8))
BYTE b = ((BYTE)((ole)>>16))

regards, Leo
Post by Lamberti Fabrizio
Hi all.
I've got an ActiveX Object that gives me OleColor codes for its graphical
components.
I need to convert these OleColor codes into RGB codes using JScript or
VBScript, becuase I have to using that color inside color style attribute of
some HTML components.
Anyone can help me ?
Thx
Loading...