Search code examples
c++windows-phone-8windows-phone-8.1

How to use namespace - Microsoft.Phone.Info - in native C++ on in WP 8.1 or WP 8


I'm working in a native C++ enviroment on WP8.1.

Let's say I want to call a functions like

Microsoft.Phone.Info::DeviceExtendedProperties.GetValue( "DeviceUniqueId" );

The problem is no matter how I try, it didn't pass compile.

I know "Microsoft.Phone.Info" is a name space,

in C# ppl wrote:

using Microsoft.Phone.Info;

but in C++, I tried

using namespace Microsoft.Phone.Info;

void func()
{
    DeviceExtendedProperties.GetValue("DeviceUniqueId");
}

didn't pass compile. or

void func()
{
    Microsoft.Phone.Info::DeviceExtendedProperties.GetValue("DeviceUniqueId");
}

didn't pass compile.

It keeps telling me something like this

'Microsoft' : illegal use of namespace identifier in expression

so how do I use this namespace properly?

Thank you guys for the reading and answering. :-) I can't find a C++ example for retriving the device ID. :-P


Solution

  • Although many of the properties from DeviceInformation can be found on EasClientDeviceInformation, the device ID is not one of them. Instead, you should look at using the ASHWID which will get you an app-specific hardware ID.