首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >获取Windows 8上的操作系统、平台和设备信息

获取Windows 8上的操作系统、平台和设备信息
EN

Stack Overflow用户
提问于 2013-09-04 03:00:46
回答 2查看 9.7K关注 0票数 4

如何获取有关Windows 8的以下信息?

平台、操作系统版本、设备名称、设备ID和运营商(不确定运营商是否适用于Windows 8)

在Windows Phone 8中,我使用以下命令检索它们:

代码语言:javascript
复制
Platform: Environment.OSVersion.Platform
OS Version: Environment.OSVersion.Version
Device name: Microsoft.Phone.Info.DeviceStatus.DeviceName
Device ID: Windows.Phone.System.Analytics.HostInformation.PublisherHostId
Carrier: Microsoft.Phone.Net.NetworkInformation.DeviceNetworkInformation.CellularMobileOperator

我正在使用C#查找与上述Windows phone8信息相当的Windows8。

EN

回答 2

Stack Overflow用户

发布于 2013-09-04 11:45:24

您可以从here获取以下信息

Windows Version

  • Processor Architecture

  • Device Category

  • Device Manufacturer

  • Device模型

有关唯一ID,请参阅UDID for windows 8

您可以从here获取以下信息

  • 应用程序版本
  • OS

Name

票数 3
EN

Stack Overflow用户

发布于 2013-11-25 13:34:20

我只让ItemNameKey,ModelNameKey,ManufacturerKey,或者那些没有十六进制数字的代码工作。其他人不知道为什么。这是工作代码,但在C++中,由于在C++/CX中没有相关内容,我将其发布在这里(花了一段时间来弄清楚C#中使用了哪些名称空间,花了大约一个小时来弄清楚如何编写任何可派生的东西&在C++中使用集合::Iterable和集合::Iterator)

代码语言:javascript
复制
using namespace Windows::System;
//using namespace Windows::System::L.Linq;
using namespace Windows::System::Threading;
using namespace Windows::Devices::Enumeration::Pnp;
 using namespace Collections;
//public class SystemInfoEstimate
//{

Platform::Array< Platform::String ^> ^StrArray;// = ref new Platform::Array< Platform::String ^>(1);

ref class MyIterator sealed: IIterator<Platform::String ^>
{
    int Index;
    public:
    MyIterator()
    {
        Index = 0;
    }


    property virtual Platform::String ^ Current 
    { 
       Platform::String ^ get()
       {
           return StrArray->get( Index );
       }
    }   
    property virtual bool HasCurrent 
    { 
       bool get()
       {
           return true;
       }
    }
    virtual bool MoveNext()
    {
        Index++;
        if (Index >=StrArray->Length)
            return false;
        return true;
    }
    virtual unsigned int GetMany( Platform::WriteOnlyArray<Platform::String ^> ^Arr)
    {
        for(int i=0; i<StrArray->Length; i++)
        {           
            Arr->set( i, StrArray[i] );
        }
        return StrArray->Length;
    }
};
ref class MyIterable sealed: IIterable<Platform::String ^>
{
public:
    virtual IIterator<Platform::String ^> ^First()
    {
        return ref new MyIterator();//StrArray[0];
    }
};

    Platform::String ^ItemNameKey = "System.ItemNameDisplay";
    Platform::String ^ ModelNameKey = "System.Devices.ModelName";
    Platform::String ^ ManufacturerKey = "System.Devices.Manufacturer";
    Platform::String ^ DeviceClassKey = "{A45C254E-DF1C-4EFD-8020-67D146A850E0},10";
    Platform::String ^ PrimaryCategoryKey = "{78C34FC8-104A-4ACA-9EA4-524D52996E57},97";
    Platform::String ^ DeviceDriverVersionKey = "{A8B865DD-2E3D-4094-AD97-E593A70C75D6},3";
    Platform::String ^ RootContainer = "{00000000-0000-0000-FFFF-FFFFFFFFFFFF}";
    Platform::String ^ RootQuery = "System.Devices.ContainerId:=\"" + RootContainer + "\"";
    Platform::String ^ HalDeviceClass = "4d36e966-e325-11ce-bfc1-08002be10318";

void GetSystemInfo()
{
    //return;
    StrArray = ref new Platform::Array< Platform::String ^>(2);
    MyIterable^ MI = ref new MyIterable();
    StrArray->set( 0, ModelNameKey );//ManufacturerKey );
    StrArray->set( 1, ManufacturerKey );
    auto v = create_task( PnpObject::CreateFromIdAsync(PnpObjectType::DeviceContainer, RootContainer, MI )//StrArray);
        );
    v.wait();
    PnpObject ^Ret = v.get();
    UINT Size = Ret->Properties->Size;
    if (Size > 0)
    {
        for(int i=0; i<StrArray->Length; i++)
        {
            IIterator< IKeyValuePair< Platform::String ^, Platform::Object ^>^ > ^ It = Ret->Properties->First();

            bool Moving = true;
            while(Moving)
            {
                Platform::String ^PropStr = It->Current->Value->ToString();
                            //You could put OutputDebugString here ^
                Moving = It->MoveNext();
            }            
        }
    }    
 }
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18599589

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档