Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[Solved][By using alternative] How to get Windows UUID?



  • Can someone teach me on how to use QUuid ?
    I already tried multiple times using GUID.
    I simply doesn't really understand the explaination in the documentation.
    I tried to find example using the 'Search' button on the right top, but I don't get any example on how to use GUID really well.
    Hope you can help me.
    Thanks in advance.



  • UUID is "Universally Unique Identifier":http://qt-project.org/doc/qt-5/quuid.html#details

    In the simplest case whenever you need to identify something uniquely you call
    @
    QUuis id = QUuid::createUuid();
    @
    and then use that id.
    It can be a key in a QMap or QHash

    If you need a string with uuid that looks like "67C8770B-44F1-410A-AB9A-F9B5446F13EE" then
    @
    QString id = QUuid::createUuid().toString();
    @
    And again use that id string.



  • Thanks for your explaination.
    Yes, I understand on that part on how to create by using QUuid.

    But, in my case, I want to get my Windows UUID.
    I notice that in the QUuid have a function get the UUID using

    @
    QUuid::operator GUID() const
    @

    In what way I can use the GUID?
    Because the function does not return any datatype.



  • Maybe you guys can ignored this post.
    I already get the serial number of the pc by using QProcess. :)



  • Glad you solved it.

    Microsoft uses UUID to generate Windows serial numbers.
    It is not possible to read Windows serial number using QUuid.


Log in to reply