469,271 Members | 1,096 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

convert OleColor into RGB

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
Jul 22 '05 #1
1 4448
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

Lamberti Fabrizio wrote:
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

Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

19 posts views Thread by Lauren Quantrell | last post: by
1 post views Thread by Logan X via .NET 247 | last post: by
3 posts views Thread by Convert TextBox.Text to Int32 Problem | last post: by
reply views Thread by Sreejumon[MVP] | last post: by
7 posts views Thread by patang | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.