convert OleColor into RGB

  • Thread starter Lamberti Fabrizio
  • Start date
L

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
 
L

Leonhardt Wille

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top