I use this codes for receving SMS inside a managed app. by C#.net (Compact
Framework - Pocket PC 2003):
private static string SMS_MSGTYPE_TEXT = "Microsoft Text SMS
Protocol";
private static long SMS_MODE_RECEIVE = 0x00000002;
[DllImport("sms.dll")]
private static extern IntPtr SmsOpen(String ptsMessageProtocol,
IntPtr dwMessageModes, ref IntPtr psmshHandle, IntPtr
phMessageAvailableEvent);
[DllImport("sms.dll")]
private static extern IntPtr SmsReadMessage(String smshHandle,
long psmsaSMSCAddress, string psmsaSourceAddress, long pstReceiveTime, byte
pbBuffer, long dwBufferSize, long pbProviderSpecificBuffer, long
dwProviderSpecificDataBuffer, long pdwBytesRead);
[DllImport("sms.dll")]
private static extern IntPtr SmsClose(IntPtr smshHandle);
and this function for receiving:
public static void ReadSMS()
{
IntPtr hSms = IntPtr.Zero;
IntPtr res = SmsOpen(SMS_MSGTYPE_TEXT,
(IntPtr)SMS_MODE_RECEIVE, ref hSms, IntPtr.Zero);
if (res != IntPtr.Zero)
{
MessageBox.Show("Can't open sms!");
}
else
{
MessageBox.Show(" sms");
IntPtr resMS = SmsReadMessage(?,?,?, ?, ?,?,?,?,?);
if (resMS != IntPtr.Zero)
{
MessageBox.Show("Can't Recive SMS");
}
else
{
MessageBox.Show(?); //? should carry the message
of sms
}
SmsClose(hSms);
}
}
I think you understand my problem, I don't know hat valuse I should use for
SmsReadMessage function.
(Sms open successfuly but can't receive)