[Qt-interest] Mac OS machine identification

Tiago Correia tiago at cnotinfor.pt
Wed Jan 21 15:45:03 CET 2009


Hi,
You could use the MAC address. check the class QNetworkInterface, method
hardwareAddress(). But for Mac there are many interfaces, so you should use
one started by "en".
 Try something like this:

QList<QNetworkInterface>  allInterf = QNetworkInterface::allInterfaces();
QString address;
// Gets first that is not the loopback
for( int i=0; i < allInterf.size(); i++ ){
// Check if interface is valid and is not loopback and MAC Address is not
empty
if( allInterf[i].isValid() && !allInterf[i].flags().testFlag(
QNetworkInterface::IsLoopBack ) && allInterf[i].hardwareAddress() != "" ){
// Check if is Ethernet interface
if( allInterf[i].name().startsWith( "en" )  ) {
address = allInterf[i].hardwareAddress();
break;
}
}
}

I hope this would help.

On Wed, Jan 21, 2009 at 1:59 PM, Serge <mb0 at km.ru> wrote:

> Hi,
>
> i'm writing trialware protection for QT program on Mac OS.
> Is there any way to receive serial numbers of HDD, BIOS ...
> so that uniquely identify machine?
>
> Best regads,
> Serge
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>



-- 
Tiago Correia
chief technology officer

cnoti inovação & desenvolvimento – Aprendizagem enRiquecida pela Tecnologia
www.cnotinfor.pt
Telefone: +351 239 499 231

Subscreva gratuitamente a nossa Newsletter BICA – Boletim informativo de
Interactividade, Comunicação e Aprendizagem
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090121/d87be357/attachment.html 


More information about the Qt-interest-old mailing list