控制台应用程序中的SMS拦截 [英] SMS interception in console application

查看:106
本文介绍了控制台应用程序中的SMS拦截的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有短信拦截器和应用程序启动器的问题...我在论坛中阅读了几个主题,但我不知道我搞砸了...所以我有一个控制台使用.net cf 3.5在winMO5 / 6中应用程序,当手机打开时,应用程序启动,做一些工作,退出后....及时我想注册短信拦截器(我做了),当我发送它开始的设备的短信,但不要在我的应用程序内发送短信接收事件(我不能使用短信的正文)这里是一个代码片段也许我没有得到一些所有这些的逻辑......
$

Hi
i have  a problem with sms interceptor and application launcher... i read several threads in the forum but i don`t know where i screw up...
so i have a console application in winMO5/6 with .net cf 3.5 and the application starts when the phone is turned on, do some work and after exit....  in time i would like to register an sms interceptor (i did it), when i send a sms to the device it start, but don`t fire the sms received event inside my app (i can`t work with the body of the sms message)
here is a code snippet maybe i dont`t got some logic of all this......

 static void Main(string[] args)
        {

            IntPtr hOldCursor = SetCursor(IntPtr.Zero);
          
            string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);

            SW = File.CreateText(path + "\\LOG.txt");

            if (MessageInterceptor.IsApplicationLauncherEnabled("myAppSMSListener"))
            {
                SW.WriteLine("Application launch from interceptor " + DateTime.Now);
                msgInterceptor = new MessageInterceptor("myAppSMSListener",false);
            }
            else
            {
                SW.WriteLine("Application launch normally " + DateTime.Now);
                msgInterceptor = new MessageInterceptor(InterceptionAction.NotifyAndDelete, true);
                msgInterceptor.MessageCondition = new MessageCondition(MessageProperty.Body, MessagePropertyComparisonType.StartsWith, "DO_SOME_WORK", true);
               
                msgInterceptor.EnableApplicationLauncher("myAppSMSListener", path + @"\DoWork.exe","handleSMS");
            }

            msgInterceptor.MessageReceived += new MessageInterceptorEventHandler(onSmsReceived);
            SW.WriteLine("Args lenght: " + args.Length);
            foreach (string a in args)
                SW.WriteLine("Arg: " + a);

            if (args.Length > 0 && args[0].Equals("handleSMS"))
            {
                    SW.WriteLine("App started with sms handler parameter " + DateTime.Now);
                 ///somehow here i need do decide what is inside the sms to do the preferred work
            }
            else
            {
               //do the normal work when the program start automatically
             }
}




任何人都有一些想法???



anybody have some idea???

推荐答案

嗨Sannyo,

通过查看代码,
见行

Hi Sannyo,

By looking into code ,
See line
  msgInterceptor.MessageReceived += new


 MessageInterceptorEventHandler(onSmsReceived);


我有查询, OnSmsReceived ()方法在哪里?

我建议你检查一下OnSmsReceived()方法。

请参阅:
如何:拦截传入的短消息系统(SMS)消息

I have query , Where is OnSmsReceived () method ?

I suggest you pls check OnSmsReceived() method.

Please refer:
How To: Intercept Incoming Short Message System (SMS) Messages




这篇关于控制台应用程序中的SMS拦截的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆