create a GUID using c++
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: create a GUID using c++

  1. #1
    Join Date
    May 1999
    Location
    Saint Paul, Minnesota, US
    Posts
    91

    create a GUID using c++

    Hi -

    I want to create a GUID in c++ and then write the value to a table using ADO and SQL Server. I understand that SQL Server supports GUIDs as a data type ...

    I only know how to use uuidgen.exe or guidgen.exe to create GUIDs ... is there a way in c++ ???

    Peace!
    Chris

  2. #2
    Join Date
    Feb 2003
    Location
    California
    Posts
    334
    Use
    Code:
    CoCreateGuid();
    Henri Hein
    Principal Engineer, Propel
    Do not credit Propel with my views or opinions.

  3. #3
    Join Date
    May 1999
    Location
    Saint Paul, Minnesota, US
    Posts
    91

    Thanks !!

    Here is the code to round out the discussion ...
    Thanks again!
    Chris


    _TUCHAR *guidStr = 0x00;

    GUID *pguid = 0x00;

    pguid = new GUID;

    CoCreateGuid(pguid);

    // Convert the GUID to a string
    UuidToString(pguid, &guidStr);

    delete pguid;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


HTML5 Development Center