Reply
ASP hex color convert for registry
Old 03-06-2008, 12:47 PM ASP hex color convert for registry
Novice Talker

Posts: 9
I have been working on this problem for about a week and have not been able to figure this one out, hopefully someone here has an idea

Here is what I am doing. I have a page where people can choose values like color, border, text displayed etc. When the person hits submit a registry file is created which is then pulled from our server and then is imported into the registry on a remote machine.

I have all the hard work done but the problem that I am having is converting a hexadecimal value into the 32bit INT that is used in the registry.

Our software coder could only tell me that colors are stored as 32 bit integers, only 24 of which are used - 8 each for the R,G and B values. Use the GetRValue, GetGValue and GetBValue Windows API calls; which I cant do from ASP.

Here are two examples:
hexadecimal #0000ff
RBG 0,0,255
registry 00ff0000
And
hexadecimal #A52A2A
RBG 165,42,42
registry 002a2aa5

So what I need to do (I think) is break down the hex value into RBG and then convert it into the value you see for registry which is where I am stuck.

Anyone have any suggestions?
urbndk is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 03-06-2008, 02:00 PM Re: ASP hex color convert for registry
chrishirst's Avatar
Super Moderator

Posts: 11,916
Location: Blackpool. UK
the 32 bit number breaks down into 4 x 8 bit numbers

and the value order is blue, green, red

so reverse the order of the RGB values and append "00"
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-06-2008, 03:13 PM Re: ASP hex color convert for registry
Novice Talker

Posts: 9
Yep I just figured this out with a few of my programmer friends.

It turns out there was a problem with how our app was saving settings into the registry that I didn't know about that was causing so many problems.
Also it turns out that the values needed to be reversed, then broken into 3 byte sets and each byte set reversed as well.
urbndk is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to ASP hex color convert for registry
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11619 seconds with 13 queries