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. StringFromCLSID

StringFromCLSID

Scheduled Pinned Locked Moved C / C++ / MFC
questionannouncement
3 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.
  • A Offline
    A Offline
    Alexander M
    wrote on last edited by
    #1

    Is there a version of StringFromCLSID for ANSI? Don't try it, just do it! ;-)

    T P 2 Replies Last reply
    0
    • A Alexander M

      Is there a version of StringFromCLSID for ANSI? Don't try it, just do it! ;-)

      T Offline
      T Offline
      Tim Smith
      wrote on last edited by
      #2

      Try UuidToString. I'm not sure if it encodes the values the exact same way. Tim Smith I'm going to patent thought. I have yet to see any prior art.

      1 Reply Last reply
      0
      • A Alexander M

        Is there a version of StringFromCLSID for ANSI? Don't try it, just do it! ;-)

        P Offline
        P Offline
        peterchen
        wrote on last edited by
        #3

        CString CGuid::ToString(bool withCurlies) const
        {

        #ifdef _UNICODE // ----- UNICODE -----------
        LPCWSTR mask = withCurlies ? L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}" :
        L"%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X";
        #else
        LPCSTR mask = withCurlies ? "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}" :
        "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X";
        #endif

        CString s;
        s.Format(mask,
        Data1, Data2, Data3, Data4[0], Data4[1],
        Data4[2], Data4[3], Data4[4], Data4[5],Data4[6], Data4[7]);
        return s;
        }


        Pandoras Gift #44: Hope. The one that keeps you on suffering.
        aber.. "Wie gesagt, der Scheiss is' Therapie"
        boost your code || Fold With Us! || sighist | doxygen

        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