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. COleVariant to COLORREF

COleVariant to COLORREF

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
4 Posts 2 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.
  • _ Offline
    _ Offline
    _Flaviu
    wrote on last edited by
    #1

    Hi all of you. How can I convert COleVariant to COLORREF ? I have used CMFCPropertyGridColorProperty to store a colorref into CMFCProperrtyGrid, but I need to retrieve correctly the colorref value, because CMFCPropertyGridColorProperty have been filled with COleVariant ... I get the value just like this:

    CMFCPropertyGridProperty* pProp = m_wndPropList.FindItemByData(TRM_PROPERTYGRID_COLORWINDOW);
    pProp->GetValue();

    but GetValue get me COleVariant, and I have there COLORREF value ... how can overcome this ? I get the following error:

    error C2440: 'return' : cannot convert from 'const COleVariant' to 'COLORREF'

    Thank you.

    D 1 Reply Last reply
    0
    • _ _Flaviu

      Hi all of you. How can I convert COleVariant to COLORREF ? I have used CMFCPropertyGridColorProperty to store a colorref into CMFCProperrtyGrid, but I need to retrieve correctly the colorref value, because CMFCPropertyGridColorProperty have been filled with COleVariant ... I get the value just like this:

      CMFCPropertyGridProperty* pProp = m_wndPropList.FindItemByData(TRM_PROPERTYGRID_COLORWINDOW);
      pProp->GetValue();

      but GetValue get me COleVariant, and I have there COLORREF value ... how can overcome this ? I get the following error:

      error C2440: 'return' : cannot convert from 'const COleVariant' to 'COLORREF'

      Thank you.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Since COLORREF is a DWORD, can't you just access the ullVal member of COleVariant?

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

      _ 2 Replies Last reply
      0
      • D David Crow

        Since COLORREF is a DWORD, can't you just access the ullVal member of COleVariant?

        "One man's wage rise is another man's price increase." - Harold Wilson

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

        _ Offline
        _ Offline
        _Flaviu
        wrote on last edited by
        #3

        Thank you, it works !

        1 Reply Last reply
        0
        • D David Crow

          Since COLORREF is a DWORD, can't you just access the ullVal member of COleVariant?

          "One man's wage rise is another man's price increase." - Harold Wilson

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

          _ Offline
          _ Offline
          _Flaviu
          wrote on last edited by
          #4

          Working late in night, tired, I didn't notice that CMFCPropertyGridColorProperty has proper methods for set/get colors: CMFCPropertyGridColorProperty Class[^]

          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