convert OleColor into RGB

Discussion in 'ASP General' started by Lamberti Fabrizio, Apr 8, 2005.

  1. 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
     
    Lamberti Fabrizio, Apr 8, 2005
    #1
    1. Advertising

  2. 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
    >
    >
     
    Leonhardt Wille, Apr 8, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    7
    Views:
    866
  2. Adam Teasdale Hartshorne

    Convert RGB as a float into unsigned chars

    Adam Teasdale Hartshorne, Oct 24, 2005, in forum: C++
    Replies:
    2
    Views:
    584
  3. manisha chawla
    Replies:
    1
    Views:
    1,071
    Oliver Wong
    Apr 3, 2007
  4. ZelluX
    Replies:
    3
    Views:
    1,959
    Peter Otten
    Dec 1, 2008
  5. Bruno Malvestuto

    Convert HEX to RGB

    Bruno Malvestuto, Aug 10, 2006, in forum: Ruby
    Replies:
    11
    Views:
    275
    Jeremy Hinegardner
    Dec 1, 2007
Loading...

Share This Page