locked
UuidCreate replacement

    Question

  • Hi,

    UuidCreate and UuidToString are not present for metro style apps, is there a replacement for these functions?

    Regards,

    Jose

    Wednesday, May 02, 2012 3:48 PM

Answers

All replies

  • Hello,

    As far as I know, you can use Platform::Guid to represent a Guid

    Guid g1(0x6fdfb204, 0xaf17, 0x479e, 0x8a, 0xce, 0xef, 0x97, 0xe0, 0xa3, 0x45, 0xc8);

    String^ res=g1.ToString();
    // Convert it to string

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, May 03, 2012 7:37 AM
  • I see, but is there a built in way to generate the UUID? i don't want to build my own function to generate UUIDs if i can avoid it.

    Bests Regards,

    Jose

    Thursday, May 03, 2012 9:24 AM

  • Some body pointed out to use Guid::NewGuid, but some how the reply was deleted before i check it as valid.


    • Marked as answer by pepone.onrez Tuesday, May 08, 2012 3:21 PM
    • Unmarked as answer by pepone.onrez Tuesday, May 08, 2012 4:44 PM
    Tuesday, May 08, 2012 3:21 PM
  • I was the one who suggested Guid::NewGuid, but could not make an example to prove it works (I'm a noob at C++).  So I deleted the post.

    It does work in C# though.

    Guid g = Guid.NewGuid();


    • Edited by jrboddie Tuesday, May 08, 2012 3:43 PM
    Tuesday, May 08, 2012 3:42 PM
  • Thanks i see, seem is not supported in C++.

    Does anybody knows if this will be added to C++?

    Tuesday, May 08, 2012 4:45 PM
  • I think it should be possible to build a simple C# class library for generating the guid that you can call from your C++ application.  Would that work for you?
    • Edited by jrboddie Tuesday, May 08, 2012 5:08 PM
    Tuesday, May 08, 2012 5:08 PM
  • Hi Jose,

    You can create a GUID with CoCreateGuid().

    --Rob

    Tuesday, May 08, 2012 8:54 PM
    Owner