Compact Framework and Phone API Questions. Help!

S

Sirfalas

Hi. I have a question which I already asked about earlier but I still
don't understand.

I have VS.NET 2003 and want to develop for smartphone applications
using vb.net. Now, all i need is the Smartphone 2003 SDK Right? Well, i
installed it. I could make a simple application and deploy it with no
problems.

Now, I want to create more complex applications and to do that, I need
to access the phone APIs. How do i do that? When I was looking over the
net, they told me to use P/Invoke.

So i read up over on a couple of MSDN Articles and I get code like
this:

----
<DllImport("coredll.dll")>
Protected Shared Function RegisterHotKey

<DllImport("coredll.dll")>
Protected Shared Function UnregisterFunc1

<DllImport("coredll.dll")>
Protected Shared Function GetAsyncKeyState
----

But how would this function even work? I mean, i can't even find
coredll.dll in my computer so how would it work? I can't find any of
the phone api DLL files on my computer? How am i supposed to make it
run? From what i understand, it seems like i need the .net compact
framework sdk or something. Now where do i get it? Please help.
 
S

Sirfalas

btw, i have already seen OpenNETCF thing. I just want to know if there
is any way to create applications that accesses phone apis without
using OpenNETCF.
 
G

Guest

Sure. Copy the OpenNETCF code and call it your own - I mean really, APIs
are APIs. There's no magic, and there's really no other way to do it. Why
would you want to waste your time re-doing what's already been done? Why
not spend your time working on your application?

-Chris
 
S

Sirfalas

hmmm, you have a good point but for some reason, i can't seem to get
opennetcf working.

you see, my application, would require me to retrieve the imei
programatically, create a gprs connection and send that info to a
server side application. I am sure i will be able to create a gprs
connection and send that information and stuff as i spend more time
programming.

But, i can't retrieve the imei. I did all the searches and im using the
getDeviceID function and it doesn't work. This is what i do

-----
Imports OpenNETCF.win32

Dim phoneCore as core
lblDeviceId = phoneCore.getDeviceId()
-----

In my emulator, it returns a fake imei, "000001-0000-0000-0000" and in
my phone, (O2 Xphone), it returns the same fake imei. I thought it was
something to do with me not having enough privileges on my cellphone or
something.

So i decided to go to
http://msdn.microsoft.com/library/d...y/en-us/dnppcgen/html/smartphone_security.asp
and look at how i can resolve this issue and after reading it, i
connected my phone to my pc via usb, created an activesync connection
and ran the command "rapiconfig /p sdktestcerts.xml " and it ran the
command successfully.

To test whether or not my phone had developer cert, i use the PHM
Registry Editor application to see if i can access all the 'locked'
registry keys and i could read them but not change them. So if my phone
supposedly has developer certificates, why would get DeviceID return me
the fake imei on my cellphone?

I read more and I saw some code regarding getlineinfo. This is the
reason i decided not to use OpenNETCF. What am i doing wrong?
 
P

Peter Foot [MVP]

The deviceid is not the IMEI number, although it should give you a unique ID
for the device. If your device is a Smartphone then the security settings on
your phone may cause the GetDeviceID method to fail since it requires your
application to be signed with a priviledged certificate - and the emulator
doesn't return a device id. We don't have any methods in the SDF for
retrieving the IMEI, but it is accessible through TAPI, and you can use Alex
Feinman's TAPI wrapper - the API method you'll need is lineGetGeneralInfo,
and this should be wrapped in Alex's library -
http://www.alexfeinman.com/download.asp?doc=tapi1.1.zip

Peter
 
S

Sirfalas

oh. is that so? Thanks Peter Foot and Ctacke. you guys have been most
helpful. I always thought DeviceID returns the IMEI. I would need the
IMEI regardless even if the deviceID is unique.

Thanks. will check out the TAPI wrapper and reply.
 
S

Sirfalas

is there a working example of this? Preferably in VB.NET. I tried to
run the examples on my O2 and it doesn't work. The program doesn't even
run.

I think i might just have to let the user enter the imei manually and i
have to get on to the other parts of my project. Like creating the GPRS
connection and stuff.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top