Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Reading the computer's serial number
#include "winrt/Windows.System.Profile.SystemManufacturers.h"
using namespace winrt::Windows::System::Profile::SystemManufacturers;
int main()
{
winrt::init_apartment();
printf("Serial number = %ls\n", SmbiosInformation::SerialNumber().c_str());
}
@kennykerr

This comment has been minimized.

Copy link
Owner Author

commented Jan 8, 2018

This example was inspired by Raymond Chen's post.

@DBJDBJ

This comment has been minimized.

Copy link

commented Jan 9, 2018

The first two includes in Raymond's code where especially troublesome :)

@DBJDBJ

This comment has been minimized.

Copy link

commented Jan 11, 2018

Out of sheer curiosity ... why the printf ? AFAIK in no code of yours, you use std::cout ?

@kennykerr

This comment has been minimized.

Copy link
Owner Author

commented Jan 12, 2018

Mainly personal preference. Both are problematic in different ways. printf is always faster and often more concise.

@DBJDBJ

This comment has been minimized.

Copy link

commented Jan 18, 2018

True indeed. Although printf() with a lot of arguments is tedious to get right, but then those examples are rare.

@iecompattest

This comment has been minimized.

Copy link

commented Jun 4, 2018

fdksjfklfd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.