What do I store a HANDLE as in Managed Code? SIMManager API query

M

Marauderz

Someone please suggest a nice source for me to read up on InterOp'ing,
Marshalling, and P/Invoking. ;) Before that though... I'm trying to access
the SIM Manager APIs and in my short test program I decided to just
initialize and deinitialize the SIMManager with the following code

The native functions involved are :-
HRESULT SimInitialize (
DWORD dwFlags,
SIMCALLBACK lpfnCallBack,
DWORD dwParam,
LPHSIM lphSim
);

HRESULT SimDeinitialize (
HSIM hSim
);

which I've defined in VB.Net as

<DllImport("cellcore.dll")> _
Function SimInitialize(ByVal flags As Int32, ByVal callBack As Int32, _
ByVal callBackParam As Int32, ByRef lpSim As Integer) As Int32

End Function

<DllImport("cellcore.dll")> _
Function SimDeinitialize(ByVal hSim As Integer) As Int32

End Function

-----
And this is my little test code.

Dim oSim As New SIMManager
Dim hSim As Integer
Dim hResults As Integer
hResults = oSim.SimInitialize(0, 0, 0, hSim)
hResults=oSim.SimDeinitialize(hSim)

I get a value in hSim after the call to initialize... but when I call
SimDeinitialized I got an unsupported exception.. =P The first 3 parameters
are 0 (or NULL right?) cause I do not require SIM callbacks.

Any help guys? Or can someone just point me to a SIMManager wrapper that has
already been made cause all I need is something to read the Phonebook
entries, don't even need to write to it. ;)

Thanks Guys,
Marauderz.
 
M

Marauderz

DOH! I DID see that article in fact.. I filed it away for future reference..
guess I didn't notice the SIM APIs would be considered part of the Phone
APIs! ;)

Thanks Chris!
 
M

Marauderz

Hey thanks for all the help Chris. You ever drop by in Malaysia give me a
call and I'll buy you a drink. ;) anyway what's interesting about all these
samples is that NONE of them access the SIM PhoneBook entry.. which if you
read the reply to my previosu query from Geoff [MS] seems to be a real
PAIN.

Of course that's before I figured out that I needed to write a Native DLL
wrapper for POOM.. hahahahaha... all this for a simple SIM Manager!! Curse
O2 for not including it in the XPHone! :(
 

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