Results 1 to 8 of 8

Thread: Microsoft SMS Sender

  1. #1

    Thread Starter
    Frenzied Member toecutter's Avatar
    Join Date
    Apr 2006
    Location
    Brisbane, Australia
    Posts
    1,160

    Microsoft SMS Sender

    The free app from microsoft sends sms from your pc via your mobile (if compatable)

    http://www.microsoft.com/downloads/d...FYu2c0fA%3d%3d

    Does any one know if we able to access the source code or how to go about contacting some one to get it?

    regards

    toe

  2. #2
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: Microsoft SMS Sender

    I would very much doubt you will get the source code.

    You could write your own using RAPI
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  3. #3
    Frenzied Member Lightning's Avatar
    Join Date
    Oct 2002
    Location
    Eygelshoven
    Posts
    1,611

    Re: Microsoft SMS Sender

    Here is code that allows you to send sms message:
    Code:
    using System;
    using System.Text;
    using System.Runtime.InteropServices;
    
    namespace myWireless 
    {
    
    #if ( !WCE && !PPC && !SP)
    #error	"Wireless functions are only for the PPC and SMARTPHONE"
    #endif
    	
    	/// <summary>
    	/// Short Message Service.
    	/// </summary>
    	public class SMS 
    	{
    		private static string	SMS_MSGTYPE_TEXT				= "Microsoft Text SMS Protocol";
    		private static long		SMS_MODE_SEND					= 0x00000002;
    		private static long		SMS_OPTION_DELIVERY_NONE		= 0x00000000;
    		//private static long		SMS_OPTION_DELIVERY_NO_RETRY	= 0x00000001;
    		//private static long		PS_MESSAGE_OPTION_NONE          = 0x00000000;
    
    		private enum SMS_DATA_ENCODING 
    		{
    			SMSDE_OPTIMAL=0,
    			SMSDE_GSM,
    			SMSDE_UCS2,
    		}
    
    		private enum PROVIDER_SPECIFIC_MESSAGE_CLASS 
    		{
    			PS_MESSAGE_CLASS0 = 0,
    			PS_MESSAGE_CLASS1,
    			PS_MESSAGE_CLASS2,
    			PS_MESSAGE_CLASS3,
    		}
    
    		private enum PROVIDER_SPECIFIC_REPLACE_OPTION 
    		{
    			PSRO_NONE = 0,
    			PSRO_REPLACE_TYPE1,
    			PSRO_REPLACE_TYPE2,
    			PSRO_REPLACE_TYPE3,
    			PSRO_REPLACE_TYPE4,
    			PSRO_REPLACE_TYPE5,
    			PSRO_REPLACE_TYPE6,
    			PSRO_REPLACE_TYPE7,
    			PSRO_RETURN_CALL,
    			PSRO_DEPERSONALIZATION,
    		}
    
    		/*
    		private struct TEXT_PROVIDER_SPECIFIC_DATA 
    		{
    			public IntPtr dwMessageOptions;
    			public PROVIDER_SPECIFIC_MESSAGE_CLASS psMessageClass;
    			public PROVIDER_SPECIFIC_REPLACE_OPTION psReplaceOption;
    		}
    		*/
    
    		[DllImport("sms.dll")]
    		private static extern IntPtr SmsOpen(String ptsMessageProtocol, IntPtr dwMessageModes, ref IntPtr psmshHandle, IntPtr phMessageAvailableEvent);
    
    		[DllImport("sms.dll")]
    		private static extern IntPtr SmsSendMessage(IntPtr smshHandle, IntPtr psmsaSMSCAddress, IntPtr psmsaDestinationAddress, IntPtr pstValidityPeriod, byte[] pbData, IntPtr dwDataSize, 
    			byte[] pbProviderSpecificData, IntPtr dwProviderSpecificDataSize, SMS_DATA_ENCODING smsdeDataEncoding,
    			IntPtr dwOptions,  IntPtr psmsmidMessageID);
    
    		[DllImport("sms.dll")]
    		private static extern IntPtr SmsClose(IntPtr smshHandle);
    
    		/// <summary>
    		/// Sends a SMS message to the phone number specified.
    		/// </summary>
    		/// <param name="sPhoneNumber">The phone number of the recipent</param>
    		/// <param name="sMessage">The message to send.</param>
    		unsafe public static void SendMessage(string sPhoneNumber, string sMessage) 
    		{
    			IntPtr hSms = IntPtr.Zero;
    
    			try 
    			{
    				IntPtr res = SmsOpen(SMS_MSGTYPE_TEXT, (IntPtr)SMS_MODE_SEND, ref hSms, IntPtr.Zero);
    				if (res != IntPtr.Zero)
    					throw new Exception("Could not open SMS.");		
    
    				Byte[] bDest = new Byte[516];
    				fixed (byte* pAddr = bDest) 
    				{
    					byte *pCurrent = pAddr;              
    					Marshal.WriteInt32((IntPtr)pCurrent, (int)AddressType.Unknown);
    					pCurrent +=4;
    
    					foreach (byte b in Encoding.Unicode.GetBytes(sPhoneNumber)) 
    					{
    						Marshal.WriteByte((IntPtr)pCurrent, b);
    						pCurrent++;
    					}		
    			
    					// The data for the TEXT_PROVIDER_SPECIFIC_DATA
    					Byte[] ProvData = new Byte[12];
    
    					byte[] bMessage = Encoding.Unicode.GetBytes(sMessage);
    					int nMsgSize = bMessage.Length;
    
    					res = SmsSendMessage(hSms, IntPtr.Zero, (IntPtr)pAddr, IntPtr.Zero, bMessage, (IntPtr)nMsgSize,
    						ProvData, (IntPtr)ProvData.Length, SMS_DATA_ENCODING.SMSDE_OPTIMAL, (IntPtr)SMS_OPTION_DELIVERY_NONE, IntPtr.Zero);
    
    					if (res != IntPtr.Zero)
    						throw new Exception("SMS send failed.");		
    				}
    			}
    			finally 
    			{
    				if (hSms != IntPtr.Zero)
    					SmsClose(hSms);
    			}
    		}
    	}
    }
    VB6 & C# (WCF LINQ) mostly


    If you need help with a WPF/WCF question post in the NEW WPF & WCF forum and we will try help the best we can

    My site

    My blog, couding troubles and solutions

    Free online tools

  4. #4
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: Microsoft SMS Sender

    HI,
    is this not just sending from the PDA - you can do this with the pocketoutlook name space easily - http://msdn.microsoft.com/en-us/netf.../bb905518.aspx

    toecutter was looking for a solution to send from the PC using the PDA

    Pete
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  5. #5

    Thread Starter
    Frenzied Member toecutter's Avatar
    Join Date
    Apr 2006
    Location
    Brisbane, Australia
    Posts
    1,160

    Re: Microsoft SMS Sender

    Quote Originally Posted by petevick View Post
    http://msdn.microsoft.com/en-us/netf.../bb905518.aspx

    toecutter was looking for a solution to send from the PC using the PDA

    Pete
    I don't think ill be able to do anything as i only have the express version.

  6. #6
    New Member
    Join Date
    Nov 2013
    Posts
    1

    Talking Re: Microsoft SMS Sender

    Quote Originally Posted by Lightning View Post
    Here is code that allows you to send sms message:
    Code:
    using System;
    using System.Text;
    using System.Runtime.InteropServices;
    
    namespace myWireless 
    {
    
    #if ( !WCE && !PPC && !SP)
    #error	"Wireless functions are only for the PPC and SMARTPHONE"
    #endif
    	
    	/// <summary>
    	/// Short Message Service.
    	/// </summary>
    	public class SMS 
    	{
    		private static string	SMS_MSGTYPE_TEXT				= "Microsoft Text SMS Protocol";
    		private static long		SMS_MODE_SEND					= 0x00000002;
    		private static long		SMS_OPTION_DELIVERY_NONE		= 0x00000000;
    		//private static long		SMS_OPTION_DELIVERY_NO_RETRY	= 0x00000001;
    		//private static long		PS_MESSAGE_OPTION_NONE          = 0x00000000;
    
    		private enum SMS_DATA_ENCODING 
    		{
    			SMSDE_OPTIMAL=0,
    			SMSDE_GSM,
    			SMSDE_UCS2,
    		}
    
    		private enum PROVIDER_SPECIFIC_MESSAGE_CLASS 
    		{
    			PS_MESSAGE_CLASS0 = 0,
    			PS_MESSAGE_CLASS1,
    			PS_MESSAGE_CLASS2,
    			PS_MESSAGE_CLASS3,
    		}
    
    		private enum PROVIDER_SPECIFIC_REPLACE_OPTION 
    		{
    			PSRO_NONE = 0,
    			PSRO_REPLACE_TYPE1,
    			PSRO_REPLACE_TYPE2,
    			PSRO_REPLACE_TYPE3,
    			PSRO_REPLACE_TYPE4,
    			PSRO_REPLACE_TYPE5,
    			PSRO_REPLACE_TYPE6,
    			PSRO_REPLACE_TYPE7,
    			PSRO_RETURN_CALL,
    			PSRO_DEPERSONALIZATION,
    		}
    
    		/*
    		private struct TEXT_PROVIDER_SPECIFIC_DATA 
    		{
    			public IntPtr dwMessageOptions;
    			public PROVIDER_SPECIFIC_MESSAGE_CLASS psMessageClass;
    			public PROVIDER_SPECIFIC_REPLACE_OPTION psReplaceOption;
    		}
    		*/
    
    		[DllImport("sms.dll")]
    		private static extern IntPtr SmsOpen(String ptsMessageProtocol, IntPtr dwMessageModes, ref IntPtr psmshHandle, IntPtr phMessageAvailableEvent);
    
    		[DllImport("sms.dll")]
    		private static extern IntPtr SmsSendMessage(IntPtr smshHandle, IntPtr psmsaSMSCAddress, IntPtr psmsaDestinationAddress, IntPtr pstValidityPeriod, byte[] pbData, IntPtr dwDataSize, 
    			byte[] pbProviderSpecificData, IntPtr dwProviderSpecificDataSize, SMS_DATA_ENCODING smsdeDataEncoding,
    			IntPtr dwOptions,  IntPtr psmsmidMessageID);
    
    		[DllImport("sms.dll")]
    		private static extern IntPtr SmsClose(IntPtr smshHandle);
    
    		/// <summary>
    		/// Sends a SMS message to the phone number specified.
    		/// </summary>
    		/// <param name="sPhoneNumber">The phone number of the recipent</param>
    		/// <param name="sMessage">The message to send.</param>
    		unsafe public static void SendMessage(string sPhoneNumber, string sMessage) 
    		{
    			IntPtr hSms = IntPtr.Zero;
    
    			try 
    			{
    				IntPtr res = SmsOpen(SMS_MSGTYPE_TEXT, (IntPtr)SMS_MODE_SEND, ref hSms, IntPtr.Zero);
    				if (res != IntPtr.Zero)
    					throw new Exception("Could not open SMS.");		
    
    				Byte[] bDest = new Byte[516];
    				fixed (byte* pAddr = bDest) 
    				{
    					byte *pCurrent = pAddr;              
    					Marshal.WriteInt32((IntPtr)pCurrent, (int)AddressType.Unknown);
    					pCurrent +=4;
    
    					foreach (byte b in Encoding.Unicode.GetBytes(sPhoneNumber)) 
    					{
    						Marshal.WriteByte((IntPtr)pCurrent, b);
    						pCurrent++;
    					}		
    			
    					// The data for the TEXT_PROVIDER_SPECIFIC_DATA
    					Byte[] ProvData = new Byte[12];
    
    					byte[] bMessage = Encoding.Unicode.GetBytes(sMessage);
    					int nMsgSize = bMessage.Length;
    
    					res = SmsSendMessage(hSms, IntPtr.Zero, (IntPtr)pAddr, IntPtr.Zero, bMessage, (IntPtr)nMsgSize,
    						ProvData, (IntPtr)ProvData.Length, SMS_DATA_ENCODING.SMSDE_OPTIMAL, (IntPtr)SMS_OPTION_DELIVERY_NONE, IntPtr.Zero);
    
    					if (res != IntPtr.Zero)
    						throw new Exception("SMS send failed.");		
    				}
    			}
    			finally 
    			{
    				if (hSms != IntPtr.Zero)
    					SmsClose(hSms);
    			}
    		}
    	}
    }

    Marshal.WriteInt32((IntPtr)pCurrent, (int)AddressType.Unknown);

    In the above line at (int)AddressType underlined as red line when i am using this code in visual studio. How can i solve that please guide me. I am new to .net. so please help me and give me a ready to use code to send sms from nokia mobile using pc suite in c# code

  7. #7
    Frenzied Member Lightning's Avatar
    Join Date
    Oct 2002
    Location
    Eygelshoven
    Posts
    1,611

    Re: Microsoft SMS Sender

    This code is for Windows Mobile 6.5 and visual Studio 2003.... newer wont work
    VB6 & C# (WCF LINQ) mostly


    If you need help with a WPF/WCF question post in the NEW WPF & WCF forum and we will try help the best we can

    My site

    My blog, couding troubles and solutions

    Free online tools

  8. #8
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Microsoft SMS Sender

    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width