SMS Control Center includes a COM-API to send SMS. This makes it very easy to add SMS functionality to your application. If you also like to receive SMS in your app, you can add rules in SMS Control Center to execute your application with command line options. In the end of this page you will find download links to a sample in dotnet. Dotnet framework 2.0 is required. Please note that SMS Control Center must be running for the SMS to be sent. How to Send SMS The SMS API includes two methods, one for sending SMS and one for query the status for an SMS. Here is the code for sending a SMS in C# Parameters = new Object[3]; Parameters[0] = textBox1.Text; // Number Parameters[1] = textBox2.Text; // Message text Parameters[2] = false; // True if you like an delivery report m_nItemID = (Int32) objApp_Late.GetType().InvokeMember("SendSMS", BindingFlags.InvokeMethod, null, objApp_Late, Parameters); To query for the status you can use the QueryStatus method. It returns a short interger with a status code. Parameters = new Object[1]; Parameters[0] = m_nItemID; // id Int16 nStatus = (Int16) m_objApp_Late.GetType().InvokeMember("QueryStatus", BindingFlags.InvokeMethod, null, m_objApp_Late, Parameters); Return codes: -1 = Invalid item id 1 = SMS in outbox 2 = SMS Sent 3 = SMS waiting to be executed How to Receive SMS First you need to add a rule in SMS Control Center to start the application when an SMS is received. There are three macros:
When your application i started it's just to parse the input command line. iIndexN = sCmdLine.IndexOf("/n"); iIndexM = sCmdLine.IndexOf("/m"); sNumber = sCmdLine.Substring(iIndexN + 2, iIndexM - iIndexN - 2); sMessage = sCmdLine.Substring(iIndexM + 2); This method will start a new instance of the executable each time a new SMS is received. If you would like to handle the received SMS in one instance you can use a mutex to check if another instance is running and just send the information as a window message or save the information in a database. bool bFirstInstance; // Check whether the application is already running. var mutex = new Mutex(true, "SCC Sample", out bFirstInstance); if (!bFirstInstance) { // If there is another instance running, get the command line agruments and // send them as a windows message to that instance. ProcessAgruments(); } | |||||||
Download sample exe Download sample project |
Management magazine search
Loading
Tuesday, August 2, 2011
SMS Software for Android and Windows Mobile, Pocket PC and SmartPhone
SMS Software for Android and Windows Mobile, Pocket PC and SmartPhone: "Add SMS Functionality To Your App"
Subscribe to:
Post Comments (Atom)
1 comment:
Hi..
SMS Software Products have capabilities to import SMS and Phone numbers from MS Excel and Notepad Text Files. This
Bulk SMS can compile Dynamic massages and personalized SMS for your customers on the basis of records imported from your Excel Files.
Thanks.
SMS Marketing
Post a Comment