Re: Send SMS with number of sender
From: Peter Foot [MVP] (feedback_at_no-spam.inthehand.com)
Date: 10/05/04
- Next message: Jose: "Parallel Port to fire pins"
- Previous message: Uwe Gebhardt: "Send SMS with number of sender"
- In reply to: Uwe Gebhardt: "Send SMS with number of sender"
- Next in thread: Johnny Salgado: "Re: Send SMS with number of sender"
- Reply: Johnny Salgado: "Re: Send SMS with number of sender"
- Reply: Uwe Gebhardt: "Re: Send SMS with number of sender"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 5 Oct 2004 10:09:47 +0100
By default the message should be sent with the settings defined by your
operator, therefore unless you change the settings on the phone your message
should be sent with your caller id. I'm not sure why the example below
places the result of the call to SmsGetPhoneNumber into the SMSC field -
this is for the Short Message Service Centre and should be left null to use
the default specified by your operator.
Have you tried the OpenNETCF.Phone.Sms functionality. All of the interop is
ready-wrapped for you - you could compare the sources to see how it is done
differently:-
http://www.opennetcf.org/sourcebrowse/view.aspx?f=d:/sites/OpenNETCF/InetPub/wwwroot/Source/OpenNETCF.Phone/Sms/Sms.cs
Peter
-- Peter Foot Windows Embedded MVP www.inthehand.com | www.opennetcf.org Do have an opinion on the effectiveness of Microsoft Windows Mobile and Embedded newsgroups? Let us know! https://www.windowsembeddedeval.com/community/newsgroups "Uwe Gebhardt" <uwe.gebhardt@freenet.de> wrote in message news:534a6e6e.0410050018.4a13b59d@posting.google.com... > Hello *, > > I created a class, which allows me to send a SMS. > I used the sendSMS example from Microsoft > (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/netcfSendSMS.asp) > > Okay, it works fine, I can send a SMS, but only without > my own number. The receiver gets an anonymous message. > I already tried to change some options in the code, but > the SMS is still missing the number of the sender. > > My code: > > unsafe public bool sendSMS(string sPhoneNumber, string sMessage) > { > System.IntPtr hSms = IntPtr.Zero; > IntPtr res = SmsOpen(SMS_MSGTYPE_TEXT, (IntPtr)SMS_MODE_SEND, ref > hSms, > IntPtr.Zero); > if (res != IntPtr.Zero) > return false; > Byte[] bDest = new Byte[516]; > Byte[] bDest2 = new Byte[516]; > > fixed (byte* pAddr = bDest) > { > fixed (byte* pAddr2 = bDest2) > { > byte *pCurrent = pAddr; > IntPtr myNumb = SmsGetPhoneNumber((IntPtr)pAddr2); > > Marshal.WriteInt32((IntPtr)pCurrent, (int)AddressType.Unknown); > pCurrent +=4; > foreach (byte b in Encoding.Unicode.GetBytes(sPhoneNumber)) > { > Marshal.WriteByte((IntPtr)pCurrent, b); > pCurrent++; > } > > Byte[] ProvData = new Byte[12]; > byte[] bMessage = Encoding.Unicode.GetBytes(sMessage); > int nMsgSize = bMessage.Length; > > res = SmsSendMessage(hSms, myNumb, (IntPtr)pAddr, IntPtr.Zero, > bMessage, (IntPtr)nMsgSize, ProvData, (IntPtr)ProvData.Length, > SMS_DATA_ENCODING.SMSDE_GSM, (IntPtr)SMS_OPTION_DELIVERY_NONE, > IntPtr.Zero); > if (res != IntPtr.Zero) > return false; > > SmsClose(hSms); > return true; > } > } > } > > Any ideas, what I'm doing wrong?
- Next message: Jose: "Parallel Port to fire pins"
- Previous message: Uwe Gebhardt: "Send SMS with number of sender"
- In reply to: Uwe Gebhardt: "Send SMS with number of sender"
- Next in thread: Johnny Salgado: "Re: Send SMS with number of sender"
- Reply: Johnny Salgado: "Re: Send SMS with number of sender"
- Reply: Uwe Gebhardt: "Re: Send SMS with number of sender"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|