Determine metro app is running in Windows 8 tab or Desktop PC

前端 未结 3 1158
孤独总比滥情好
孤独总比滥情好 2020-12-06 02:06

I am developing app with windows 8 metro style. This app has some more feature if it running in desktop pc compared to Tablet. But my problem is how to detect app is running

3条回答
  •  醉话见心
    2020-12-06 02:14

    My suggestion would be to call down to the GetSystemInfo API in the CoreDLL

    Here is an example call:

        [DllImport("coredll")]
        static extern void GetSystemInfo(ref SYSTEM_INFO pSI); 
    
        public struct SYSTEM_INFO
        {
            public uint dwOemId;
            public uint dwPageSize;
            public uint lpMinimumApplicationAddress;
            public uint lpMaximumApplicationAddress;
            public uint dwActiveProcessorMask;
            public uint dwNumberOfProcessors;
            public uint dwProcessorType;
            public uint dwAllocationGranularity;
            public uint dwProcessorLevel;
            public uint dwProcessorRevision;
        }
    

    If you fetch this information from the tablet, it should return a processor type of 2577 because it is running on ARM processors I believe. You might need to find the specific processor type you are targeting or pass in a list of targeted processor types.

提交回复
热议问题