Obtain common information of Windows Mobile

Source: Internet
Author: User

Generally, when formulating network protocols, the client often needs to generate or obtain unique and non-duplicate IDs, supplemented by platform and version information as part of the Protocol, backend servers can perform statistical processing based on the information. here we will make a summary of the methods for obtaining these commonly used information.

 

1. development platform. here we need to know whether it is PPC or smartphon. in fact, this has little to do with the Protocol, but it is closely related to client development. smartphone and PPC have different definitions for clientrect, so we need to dynamically differentiate them. Here we need to use the classic control panel function systemparametersinfo. the Code should be as follows:

Tchar szplatform [30];
Systemparametersinfo (spi_getplatformtype, sizeof (szplatform), szplatform, 0 );
If (_ tcscmp (szplatform, _ T ("Smartphone") = 0)
// On Pocket PC, szplatform wocould be "pocketpc"
{}

 

2. mobile phone model. this is also common information customized for mobile phones during development. for example, some mobile phones like i900 have very strange screen sizes, such as 240*400. how can we get the i900 information? Similarly, it is the systemparametersinfo function, but it is different parameters:

Tchar szdevicename [30];
Systemparametersinfo (spi_getoeminfo, sizeof (szdevicename), szdevicename, 0 );

Of course, after the function is successfully executed, you 'd better check what the szdevicename content is, because some mobile phone abbreviations may not necessarily be reflected through this function, not exactly the same as the name you think, for example, i900 gets the value of "sgh-i900", for example, HTC Touch pro, after trying, the return value is "vogu100 ".

 

3. device ID. this ID is unique to a very strange mobile phone. he is surprised to say that this ID is not the same as an IMEI or a phone number found on a phone
Based device, both of which can be changed, but instead this code lives
And dies with the device. This ID is neither an IMEI nor a phone number. In this case, this ID will not change! Let's look at this code and show him what this ID is:

// Application specific data <br/> // {region} <br/> const guid bapplicationdata1 = {0x8d552bd1, 0xe133, 0x4107, {0xb7, 0x2d, 0x38, 0xb6, 0xa4, 0x72, 0x64, 0x39 }}; <br/> const DWORD cbapplicationdata1 = sizeof (bapplicationdata1); <br/> g_cbdeviceid1 = getdeviceuniqueid_v1_output; <br/> hR = getdeviceuniqueid (reinterpret_cast <lpbyte> (const_cast <lpguid> (& bapplicationdata1), <br/> cbapplicationdata1, <br/> getdeviceuniqueid_v1, <br/> g_bdeviceid1, <br/> & g_cbdeviceid1 );

This code can be found in the SDK sample (Windows Mobile 5.0 Pocket pc sdk/samples/CPP/Win32/getdeviceid). The structure of this ID is similar to guid, but it is not a guid, it is a hash value of the guid of your application and some hardware features! Therefore, if you use different guids as parameters, you will get different device IDs! Although some people say they have obtained the same DeviceID on different HTC mobile phones, I tested d600, S1, and HTC Touch here and their values are different, therefore, it is more appropriate to use this ID to identify mobile phones!

 

4. IMEI and imsi.

This is a traditional problem, and it also has their shadows in the SDK sample!

The location is in the Windows Mobile 5.0 Pocket pc sdk/samples/CPP/Win32/cellcore/extapi project and there is a way to call it around linegetgeneralinfo (the code is not posted) however, this is a privileged function that can be used after being signed in Windows Mobile 6.0 and smarphone, for the signature method, click sign the project output in the Visual C ++ project. here is a detailed description! It should be noted that imsi is not unusable. This ID is stored in the SIM card, but it indicates the authentication on the GSM network! So if your mobile phone is used in the CDMA network, you don't know how to get this ID .... the linegetgeneralinfo here can read the IMEI and imsi information at the same time, as well as the factory information (this information is the chipset manufacturer, such as Qualcomm :))! In the retrieval of this number, rIL can also obtain the IMEI information (ril_initializ is a function), but some official statements are not recommended, so we won't start it here.

 

5. Mobile phone number

This is something that many people have always wanted. We didn't see any trace in previous versions, but it seems to have been available since 6.0. On Microsoft's web page saw such a thing: http://msdn.microsoft.com/en-us/library/bb158759.aspx here said in the SDK below an example, this example is the SDK below the sample,C:/program files/Windows Mobile 6 SDK/samples/common/CPP/Win32/getphonenumber. The same Code will not be posted. to highlight this description, let's take a look:

For this sample, it is assumed that the mobile device uses a sim with the device's phone number programmed into it. Some devices do not store their phone number on a sim.
These devices, there is no way to programmatically determine
Device's phone number and this sample will not successfully return
Number.

This
Application does not need to run privileged (I. e., it does not need
Be signed with a certificate from the privileged store ).

First of all, there is a SIM card, and there is no SIM card to talk about. In addition, you need to put the mobile phone number in the SIM card, otherwise there is no way to talk about it.

 

Okay. So far, three useful functions must be remembered:

Systemparametersinfo,GetdeviceuniqueidAndLinegetgeneralinfoWith these three functions, you can find some answers to common platform features!

 

 

 

 

 

Related Article

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.