Kani Str
asked on
detect IMEI number
i need to find the imei number proramatically, possible? if so how? I'm using VS 2005 and VB
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
here is the working code...
Dim t As New OpenNETCF.Tapi.Tapi
t.Initialize()
Dim l As OpenNETCF.Tapi.Line = t.CreateLine(0, OpenNETCF.Tapi.LINEMEDIAMO DE.INTERAC TIVEVOICE,
OpenNETCF.Tapi.LINECALLPRI VILEGE.MON ITOR)
Dim lgi As New GeneralInfo
Dim buffer(512) As Byte
'write size
BitConverter.GetBytes(512) .CopyTo(bu ffer, 0)
If lineGetGeneralInfo(l.hLine , buffer) <> 0 Then
Throw New System.ComponentModel.Win3 2Exception (System.Ru ntime.Inte ropService s.Marshal. GetLastWin 32Error(), "TAPI
Error: " + System.Runtime.InteropServ ices.Marsh al.GetLast Win32Error ().ToStrin g("X"))
End If
Dim serialsize As Integer = BitConverter.ToInt32(buffe r, 36)
Dim serialoffset As Integer = BitConverter.ToInt32(buffe r, 40)
lgi.SerialNumber = System.Text.Encoding.Unico de.GetStri ng(buffer, serialoffset, serialsize)
lgi.SerialNumber = lgi.SerialNumber.Substring (0, lgi.SerialNumber.IndexOf(C hr(0)))
' Dim gi As GeneralInfo = GetGeneralInfo(l)
'lblManufacturer.Text = gi.Manufacturer
'lblModel.Text = gi.Model
' lblRevision.Text = gi.Revision
' lblSubscriber.Text = gi.SubscriberNumber
l.Dispose()
t.Shutdown()
Return lgi.SerialNumber
Dim t As New OpenNETCF.Tapi.Tapi
t.Initialize()
Dim l As OpenNETCF.Tapi.Line = t.CreateLine(0, OpenNETCF.Tapi.LINEMEDIAMO
OpenNETCF.Tapi.LINECALLPRI
Dim lgi As New GeneralInfo
Dim buffer(512) As Byte
'write size
BitConverter.GetBytes(512)
If lineGetGeneralInfo(l.hLine
Throw New System.ComponentModel.Win3
Error: " + System.Runtime.InteropServ
End If
Dim serialsize As Integer = BitConverter.ToInt32(buffe
Dim serialoffset As Integer = BitConverter.ToInt32(buffe
lgi.SerialNumber = System.Text.Encoding.Unico
lgi.SerialNumber = lgi.SerialNumber.Substring
' Dim gi As GeneralInfo = GetGeneralInfo(l)
'lblManufacturer.Text = gi.Manufacturer
'lblModel.Text = gi.Model
' lblRevision.Text = gi.Revision
' lblSubscriber.Text = gi.SubscriberNumber
l.Dispose()
t.Shutdown()
Return lgi.SerialNumber
ASKER