次の方法で共有


Detecting whether your application is running on the DeviceEmulator or not

The best way for apps to detect if they are running on the Device Emulator is to use this snippet of code:

 WCHAR wszMachineName[128];
SystemParametersInfo(SPI_GETOEMINFO, sizeof(wszMachineName),
          &wszMachineName, 0);

On the DeviceEmulator, it will return with wszMachineName set to "Microsoft DeviceEmulator".

For a more complete code sample, follow the MSDN article:  https://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppcgen/html/ppc_hpocket.asp.

Comments