M
Marauderz
Hi guys I'm trying to make a wrapper to the SIMManager's phonebook commands,
has anyone done it? anyway I'm running into some problems with defining
the phone book datastructure. The SDK defines it as
typedef struct simphonebookentry_tag {
DWORD cbSize;
DWORD dwParams;
TCHAR lpszAddress[MAX_LENGTH_ADDRESS];
DWORD dwAddressType;
DWORD dwNumPlan;
TCHAR lpszText[MAX_LENGTH_PHONEBOOKENTRYTEXT];
} SIMPHONEBOOKENTRY, *LPSIMPHONEBOOKENTRY;
So would this do the same if I defined it in VB.NEt?
<StructLayout(LayoutKind.Sequential)> _
Public Structure PhoneBookEntryInfo
Public cbSize As Int32
Public dwParams As Int32
<VBFixedString(256)> Public lpszAddress As String
Public dwAddressType As Int32
Public dwNumPlan As Int32
<VBFixedString(256)> Public lpszText As String
End Structure
Evidently it doesn't... cause when I try to send the cbSize parameter by
using a call as follows :-
Dim oRead As New SIMManager.PhoneBookEntryInfo
oRead.cbSize = Marshal.SizeOf(oRead)
But I'm getting a size of 24! which is definetly not what I want!
the call I'm trying to emulate is this :-
HRESULT SimReadPhonebookEntry (
HSIM hSim,
DWORD dwLocation,
DWORD dwIndex,
LPSIMPHONEBOOKENTRY lpPhonebookEntry
);
my dllDeclare is this :-
<DllImport("cellcore.dll")> _
Function SimReadPhoneBookEntry(ByVal hSim As IntPtr, ByVal dwLocation As
Int32, ByVal dwIndex As Int32, ByRef PhoneEntry As PhoneBookEntryInfo) As
Integer
End Function
So how warm am I to getting this right? I know it's wrong cause I'm getting
the usual not supported error...
Thanks
has anyone done it? anyway I'm running into some problems with defining
the phone book datastructure. The SDK defines it as
typedef struct simphonebookentry_tag {
DWORD cbSize;
DWORD dwParams;
TCHAR lpszAddress[MAX_LENGTH_ADDRESS];
DWORD dwAddressType;
DWORD dwNumPlan;
TCHAR lpszText[MAX_LENGTH_PHONEBOOKENTRYTEXT];
} SIMPHONEBOOKENTRY, *LPSIMPHONEBOOKENTRY;
So would this do the same if I defined it in VB.NEt?
<StructLayout(LayoutKind.Sequential)> _
Public Structure PhoneBookEntryInfo
Public cbSize As Int32
Public dwParams As Int32
<VBFixedString(256)> Public lpszAddress As String
Public dwAddressType As Int32
Public dwNumPlan As Int32
<VBFixedString(256)> Public lpszText As String
End Structure
Evidently it doesn't... cause when I try to send the cbSize parameter by
using a call as follows :-
Dim oRead As New SIMManager.PhoneBookEntryInfo
oRead.cbSize = Marshal.SizeOf(oRead)
But I'm getting a size of 24! which is definetly not what I want!
the call I'm trying to emulate is this :-
HRESULT SimReadPhonebookEntry (
HSIM hSim,
DWORD dwLocation,
DWORD dwIndex,
LPSIMPHONEBOOKENTRY lpPhonebookEntry
);
my dllDeclare is this :-
<DllImport("cellcore.dll")> _
Function SimReadPhoneBookEntry(ByVal hSim As IntPtr, ByVal dwLocation As
Int32, ByVal dwIndex As Int32, ByRef PhoneEntry As PhoneBookEntryInfo) As
Integer
End Function
So how warm am I to getting this right? I know it's wrong cause I'm getting
the usual not supported error...
Thanks