Click here to Skip to main content
15,897,187 members
Articles / Programming Languages / C++

Searching for a Reliable Hardware ID

Rate me:
Please Sign up or sign in to vote.
4.93/5 (106 votes)
26 Mar 2020CPOL3 min read 288.6K   17.7K   212  
How a computer can be identified in order to generate a unique ID
Many desktop application developers need to uniquely identify the computer on which their software is running. This article will show you how it can be done.
��// Microsoft Visual C++ generated resource script.

//

#include "resource.h"



#define APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////

//

// Generated from the TEXTINCLUDE 2 resource.

//

#ifndef APSTUDIO_INVOKED

#include "targetver.h"

#endif

#include "afxres.h"

#include "verrsrc.h"



/////////////////////////////////////////////////////////////////////////////

#undef APSTUDIO_READONLY_SYMBOLS



/////////////////////////////////////////////////////////////////////////////

// English (United States) resources



#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)

LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US



/////////////////////////////////////////////////////////////////////////////

//

// Dialog

//



IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62

STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU

CAPTION "About GetMacAddress_by_Michael_Haephrati"

FONT 8, "MS Shell Dlg", 0, 0, 0x1

BEGIN

    ICON            IDR_MAINFRAME,IDC_STATIC,14,14,21,20

    LTEXT           "GetMacAddress_by_Michael_Haephrati, Version 1.0",IDC_STATIC,42,14,114,8,SS_NOPREFIX

    LTEXT           "Copyright (C) 2012",IDC_STATIC,42,26,114,8

    DEFPUSHBUTTON   "OK",IDOK,113,41,50,14,WS_GROUP

END



IDD_GETMACADDRESS_BY_MICHAEL_HAEPHRATI_DIALOG DIALOGEX 0, 0, 320, 95

STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU

EXSTYLE WS_EX_APPWINDOW

CAPTION "GetMacAddress_by_Michael_Haephrati"

FONT 8, "MS Shell Dlg", 0, 0, 0x1

BEGIN

    DEFPUSHBUTTON   "OK",IDOK,209,74,50,14

    PUSHBUTTON      "Cancel",IDCANCEL,263,74,50,14

END





/////////////////////////////////////////////////////////////////////////////

//

// Version

//



VS_VERSION_INFO VERSIONINFO

 FILEVERSION 1,0,0,1

 PRODUCTVERSION 1,0,0,1

 FILEFLAGSMASK 0x3fL

#ifdef _DEBUG

 FILEFLAGS 0x1L

#else

 FILEFLAGS 0x0L

#endif

 FILEOS 0x40004L

 FILETYPE 0x1L

 FILESUBTYPE 0x0L

BEGIN

    BLOCK "StringFileInfo"

    BEGIN

        BLOCK "040904B0"

        BEGIN

            VALUE "CompanyName", "TODO: <Company name>"

            VALUE "FileDescription", "GetMacAddress_by_Michael_Haephrati"

            VALUE "FileVersion", "1.0.0.1"

            VALUE "InternalName", "GetMacAddress_by_Michael_Haephrati.exe"

            VALUE "LegalCopyright", "TODO: (c) <Company name>.  All rights reserved."

            VALUE "OriginalFilename", "GetMacAddress_by_Michael_Haephrati.exe"

            VALUE "ProductName", "TODO: <Product name>"

            VALUE "ProductVersion", "1.0.0.1"

        END

    END

    BLOCK "VarFileInfo"

    BEGIN

        VALUE "Translation", 0x409, 1200

    END

END





/////////////////////////////////////////////////////////////////////////////

//

// DESIGNINFO

//



#ifdef APSTUDIO_INVOKED

GUIDELINES DESIGNINFO

BEGIN

    IDD_ABOUTBOX, DIALOG

    BEGIN

        LEFTMARGIN, 7

        RIGHTMARGIN, 163

        TOPMARGIN, 7

        BOTTOMMARGIN, 55

    END



    IDD_GETMACADDRESS_BY_MICHAEL_HAEPHRATI_DIALOG, DIALOG

    BEGIN

        LEFTMARGIN, 7

        RIGHTMARGIN, 313

        TOPMARGIN, 7

        BOTTOMMARGIN, 88

    END

END

#endif    // APSTUDIO_INVOKED





/////////////////////////////////////////////////////////////////////////////

//

// String Table

//



STRINGTABLE

BEGIN

    IDS_ABOUTBOX            "&About GetMacAddress_by_Michael_Haephrati..."

END



#endif    // English (United States) resources

/////////////////////////////////////////////////////////////////////////////





/////////////////////////////////////////////////////////////////////////////

// Hebrew (Israel) resources



#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HEB)

LANGUAGE LANG_HEBREW, SUBLANG_DEFAULT



#ifdef APSTUDIO_INVOKED

/////////////////////////////////////////////////////////////////////////////

//

// TEXTINCLUDE

//



1 TEXTINCLUDE 

BEGIN

    "resource.h\0"

END



2 TEXTINCLUDE 

BEGIN

    "#ifndef APSTUDIO_INVOKED\r\n"

    "#include ""targetver.h""\r\n"

    "#endif\r\n"

    "#include ""afxres.h""\r\n"

    "#include ""verrsrc.h""\r\n"

    "\0"

END



3 TEXTINCLUDE 

BEGIN

    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"

    "#define _AFX_NO_OLE_RESOURCES\r\n"

    "#define _AFX_NO_TRACKER_RESOURCES\r\n"

    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"

    "\r\n"

    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"

    "LANGUAGE 9, 1\r\n"

    "#include ""res\\GetMacAddress_by_Michael_Haephrati.rc2""  // non-Microsoft Visual C++ edited resources\r\n"

    "#include ""afxres.rc""      // Standard components\r\n"

    "#endif\r\n"

    "\0"

END



#endif    // APSTUDIO_INVOKED





/////////////////////////////////////////////////////////////////////////////

//

// Icon

//



// Icon with lowest ID value placed first to ensure application icon

// remains consistent on all systems.

IDR_MAINFRAME           ICON                    "res\\GetMacAddress_by_Michael_Haephrati.ico"

#endif    // Hebrew (Israel) resources

/////////////////////////////////////////////////////////////////////////////







#ifndef APSTUDIO_INVOKED

/////////////////////////////////////////////////////////////////////////////

//

// Generated from the TEXTINCLUDE 3 resource.

//

#define _AFX_NO_SPLITTER_RESOURCES

#define _AFX_NO_OLE_RESOURCES

#define _AFX_NO_TRACKER_RESOURCES

#define _AFX_NO_PROPERTY_RESOURCES



#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)

LANGUAGE 9, 1

#include "res\GetMacAddress_by_Michael_Haephrati.rc2"  // non-Microsoft Visual C++ edited resources

#include "afxres.rc"      // Standard components

#endif



/////////////////////////////////////////////////////////////////////////////

#endif    // not APSTUDIO_INVOKED



By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
CEO Secured Globe, Inc.
United States United States
Michael Haephrati is a music composer, an inventor and an expert specializes in software development and information security, who has built a unique perspective which combines technology and the end user experience. He is the author of a the book Learning C++ , which teaches C++ 20, and was published in August 2022.

He is the CEO of Secured Globe, Inc., and also active at Stack Overflow.

Read our Corporate blog or read my Personal blog.





Comments and Discussions