● Phone을 키고 *#06# 키를 누르면 IMEI가 디스플레이 됩니다.
● source 로는 아래와 같이 사용합니다.
#define TAPI_API_LOW_VERSION 0x00020000
#define TAPI_API_HIGH_VERSION 0x00020000
#define EXT_API_LOW_VERSION 0x00010000
#define EXT_API_HIGH_VERSION 0x00010000
#define CELLTSP_LINENAME_STRING (L"Cellular Line")
// Need Signature
BOOL GetIMEI(CString &csIMEI)
{
DWORD dwNumDevs;
DWORD dwAPIVersion = TAPI_API_HIGH_VERSION;
LINEINITIALIZEEXPARAMS liep;
HLINEAPP hLineApp = 0;
HLINE hLine = 0;
DWORD dwExtVersion;
LPBYTE pLineGeneralInfoBytes = NULL;
DWORD dwTAPILineDeviceID = (DWORD)-1;
const DWORD dwMediaMode = LINEMEDIAMODE_DATAMODEM | LINEMEDIAMODE_INTERACTIVEVOICE;
LINEGENERALINFO lviGeneralInfo;
LPLINEGENERALINFO plviGeneralInfo;
TCHAR szUnavailable[255];
LPTSTR tsSerialNumber = szUnavailable;
liep.dwTotalSize = sizeof(liep);
liep.dwOptions = LINEINITIALIZEEXOPTION_USEEVENT;
if (lineInitializeEx(&hLineApp, 0, 0, NULL, &dwNumDevs, &dwAPIVersion, &liep))
{
return FALSE;
}
for(DWORD dwCurrentDevID = 0 ; dwCurrentDevID < dwNumDevs ; dwCurrentDevID++)
{
DWORD dwAPIVersion;
LINEEXTENSIONID LineExtensionID;
if(0 != lineNegotiateAPIVersion(hLineApp, dwCurrentDevID,
TAPI_API_LOW_VERSION, TAPI_API_HIGH_VERSION,
&dwAPIVersion, &LineExtensionID))
{
continue;
}
LINEDEVCAPS LineDevCaps;
LineDevCaps.dwTotalSize = sizeof(LineDevCaps);
if(0 == lineGetDevCaps(hLineApp, dwCurrentDevID,
dwAPIVersion, 0, &LineDevCaps))
{
BYTE* pLineDevCapsBytes = new BYTE[LineDevCaps.dwNeededSize];
if(NULL == pLineDevCapsBytes)
{
lineShutdown(hLineApp);
return FALSE;
}
LINEDEVCAPS* pLineDevCaps = (LINEDEVCAPS*)pLineDevCapsBytes;
pLineDevCaps->dwTotalSize = LineDevCaps.dwNeededSize;
if(0 == lineGetDevCaps(hLineApp, dwCurrentDevID,
dwAPIVersion, 0, pLineDevCaps))
{
if(0 == _tcscmp((TCHAR*)((BYTE*)pLineDevCaps+pLineDevCaps->dwLineNameOffset),
CELLTSP_LINENAME_STRING))
{
dwTAPILineDeviceID = dwCurrentDevID;
break;
}
}
delete[] pLineDevCapsBytes;
}
}
if ((DWORD)-1 == dwTAPILineDeviceID)
{
lineShutdown(hLineApp);
return FALSE;
}
if(lineOpen(hLineApp, dwTAPILineDeviceID,
&hLine, dwAPIVersion, 0, 0,
LINECALLPRIVILEGE_OWNER, dwMediaMode, 0))
{
lineShutdown(hLineApp);
return FALSE;
}
if (lineNegotiateExtVersion(hLineApp, dwTAPILineDeviceID,
dwAPIVersion, EXT_API_LOW_VERSION,
EXT_API_HIGH_VERSION, &dwExtVersion))
{
lineClose(hLine);
lineShutdown(hLineApp);
return FALSE;
}
lviGeneralInfo.dwTotalSize = sizeof(lviGeneralInfo);
if (lineGetGeneralInfo(hLine, &lviGeneralInfo))
{
lineClose(hLine);
lineShutdown(hLineApp);
return FALSE;
}
pLineGeneralInfoBytes = new BYTE[lviGeneralInfo.dwNeededSize];
if(NULL == pLineGeneralInfoBytes)
{
lineClose(hLine);
lineShutdown(hLineApp);
return FALSE;
}
plviGeneralInfo = (LPLINEGENERALINFO)pLineGeneralInfoBytes;
plviGeneralInfo->dwTotalSize = lviGeneralInfo.dwNeededSize;
if (lineGetGeneralInfo(hLine, plviGeneralInfo))
{
delete [] pLineGeneralInfoBytes;
lineClose(hLine);
lineShutdown(hLineApp);
return FALSE;
}
if(plviGeneralInfo->dwSerialNumberSize > 0)
{
tsSerialNumber = (WCHAR*)(((BYTE*)plviGeneralInfo)+plviGeneralInfo->dwSerialNumberOffset);
}
csIMEI = tsSerialNumber;
delete [] pLineGeneralInfoBytes;
lineClose(hLine);
lineShutdown(hLineApp);
return TRUE;
}
'Hello CE,Mobile' 카테고리의 다른 글
CE 유용한 명령어 (0) | 2012.10.26 |
---|---|
Windows CE 6.0 설치 (0) | 2012.09.26 |
uldr.nb0 (0) | 2012.08.31 |
CreateSemaphore (0) | 2012.07.26 |
TouchCalibrate() (0) | 2012.07.25 |