Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. converting decimal to hexadecimal

converting decimal to hexadecimal

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SAK
    wrote on last edited by
    #1

    Hi I wanted to create a function that takes 3 integer color values, between 0-255. The function uses a variable of the type COLORREF which is a hexadecimal value. How can I can convert the three decimal values into a COLORREF value; How can I make decimal 255, 0, 255 into 0x00ff00ff Thank you, SAK

    C 1 Reply Last reply
    0
    • S SAK

      Hi I wanted to create a function that takes 3 integer color values, between 0-255. The function uses a variable of the type COLORREF which is a hexadecimal value. How can I can convert the three decimal values into a COLORREF value; How can I make decimal 255, 0, 255 into 0x00ff00ff Thank you, SAK

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      The RGB macro converts three unsigned chars into a COLORREF value. The GetRValue, GetGValue, GetBValue macros pull them out again. COLORREF magenta = RGB(255,0,255); Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001

      Sonork ID 100.10002:MeanManOz

      I live in Bob's HungOut now

      S 1 Reply Last reply
      0
      • C Christian Graus

        The RGB macro converts three unsigned chars into a COLORREF value. The GetRValue, GetGValue, GetBValue macros pull them out again. COLORREF magenta = RGB(255,0,255); Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001

        Sonork ID 100.10002:MeanManOz

        I live in Bob's HungOut now

        S Offline
        S Offline
        SAK
        wrote on last edited by
        #3

        Thank you for help!!

        J 1 Reply Last reply
        0
        • S SAK

          Thank you for help!!

          J Offline
          J Offline
          Jon Hulatt
          wrote on last edited by
          #4

          I wouldn't make that into a function. Just use the macro as if it was a function. Sorry to dissapoint you all with my lack of a witty or poignant signature.

          C 1 Reply Last reply
          0
          • J Jon Hulatt

            I wouldn't make that into a function. Just use the macro as if it was a function. Sorry to dissapoint you all with my lack of a witty or poignant signature.

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            Jon Hulatt wrote: I wouldn't make that into a function. Just use the macro as if it was a function. He's saying he's written a function which takes three unsgined chars and *uses* a COLORREF, not that it's point of existence is to create one. At least, I *hope* that was what he was saying.... Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001

            Sonork ID 100.10002:MeanManOz

            I live in Bob's HungOut now

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups