How to detect the wince operating platform)

Source: Internet
Author: User
# Define Pocketpcv1 1  # Define Smartphonev1 2  # Define Pocketpcv2 3  # Define Smartphonev2 4  Int Mydevicetype () {tchar szplatform [max_string_buffer]; Int Idevicetype = 0 ; Osversioninfo osver; getversionex (& osver ); If (Osver. dwmajorversion = 3 ){ If (Systemparametersinfo (spi_getplatformtype, Sizeof (Szplatform), szplatform, 0 )! = 0 ){ If (Lstrcmp (szplatform, text ( "Pocketpc" ) = 0 ) Idevicetype = pocketpcv1; // Runs on Pocket PC 2000 and 2002  Else if (Lstrcmp (szplatform, text ( "Smartphone" ) = 0 ) Idevicetype = smartphonev1; // Runs on Smartphone 2002 } Else { If (Getlasterror () = error_access_denied) // (5) Idevicetype = smartphonev1; // Is a smartphone: // smartphone creates an Access Denied error on // systemparametersinfo () }} Else { If (Osver. dwmajorversion = 4 ){ If (Systemparametersinfo (spi_getplatformtype, Sizeof (Szplatform), szplatform, 0 )! = 0 ){ If (Lstrcmp (szplatform, text ( "Pocketpc" ) = 0 ) Idevicetype = pocketpcv2; // Runs on Pocket PC 2003  Else if (Lstrcmp (szplatform, text ( "Smartphone" ) = 0 ) Idevicetype = smartphonev2;// Runs on Smartphone 2003 } Else { If (Getlasterror () = error_access_denied) // (5) Idevicetype = smartphonev2; // Is a smartphone: // smartphone creates an Access Denied error on // systemparametersinfo () }}} Return Idevicetype ;}

 
On smartphone, calling "systemparametersinfo ()" may fail due to "Access Denied", depending on whether the smartphone is locked and applied.ProgramSigned certificate. This is because only such a platform fails to be called because of access denied, so you can also use it as a flag for smartphone.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.