积极答复者
请教短信拦截的问题

问题
-
我知道MapiRule可以拦截短信,但是MapiRule在手机上,需要重启才能生效 ,所以我打算用IMAPIAdviseSink来实现,查了一下,只有CSDN上的无聊客发了几篇相关的文章,但是信息还是太少,想请问一下各位怎么样用拦截短信以及获取短信的发件人号码的?谢谢
我是用hellosms的例子发的短信,不知道能不能获取到:
typedef struct _NEWMAIL_NOTIFICATION
上面除了lpszMessageClass是短信内容之外,其他东西不知道是不是跟发送时的哪些ID匹配? 我不想通过短信内容来判断,而想通过发送号码或者上面结构中的ID来判断.
{
ULONG cbEntryID;
LPENTRYID lpEntryID;
ULONG cbParentID;
LPENTRYID lpParentID;
ULONG ulFlags;
LPTSTR lpszMessageClass;
ULONG ulMessageFlags;
} NEWMAIL_NOTIFICATION;
答案
-
可以获取到你想到的LPNOTIFICATION中的数据,在OnNotify函数中,有一个参数就是LPNOTIFICATION,可以从这里面获取下面的结构的值:
typedef struct _NEWMAIL_NOTIFICATION
{
ULONG cbEntryID;
LPENTRYID lpEntryID;
ULONG cbParentID;
LPENTRYID lpParentID;
ULONG ulFlags;
LPTSTR lpszMessageClass;
ULONG ulMessageFlags;
} NEWMAIL_NOTIFICATION;
下面的链接中包含一个示例,请参考:
http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesnative/thread/b0d4d6b8-819f-4744-b82b-4784a40e3f24
Please remember to mark the replies as answers if they help and unmark them if they provide no help- 已标记为答案 Guang-Ming Bian - MSFTModerator 2009年10月22日 3:42
-
你看了我给你的示例了吗:
下面的链接中包含一个示例,请参考:
http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesnative/thread/b0d4d6b8-819f-4744-b82b-4784a40e3f24
上面会得到lpEntryID,通过这个lpEnryID, 用IMsgStore::OpenEntry 得到IMessage对象,这个对象里面包括电话内容。
Please remember to mark the replies as answers if they help and unmark them if they provide no help- 已标记为答案 anyjoy 2009年10月27日 2:14
全部回复
-
如果使用.NET CF的话,短信拦截很方便,直接使用Microsoft.WindowsMobile.PocketOutlook.MessageInterception就可以,
详细请参考MSDN:http://msdn.microsoft.com/en-us/library/microsoft.windowsmobile.pocketoutlook.messageinterception.messageinterceptor.aspx
也可以参考Blog:PhoneFinder--寻找丢失的手机 ,里面用到了MessageInterception。
希望对你有用。
施炯 -
如果使用.NET CF的话,短信拦截很方便,直接使用Microsoft.WindowsMobile.PocketOutlook.MessageInterception就可以,
你好,我用的是C++,不知道有没有更好办法?
详细请参考MSDN:http://msdn.microsoft.com/en-us/library/microsoft.windowsmobile.pocketoutlook.messageinterception.messageinterceptor.aspx
也可以参考Blog:PhoneFinder--寻找丢失的手机 ,里面用到了MessageInterception。
希望对你有用。
施炯 -
IMailRuleClient 可以接收邮件的时候进行拦截,具体请参考SDK的例子:
D:\Program Files\Windows Mobile 6 SDK\Samples\Common\CPP\Win32\MapiRule
Please remember to mark the replies as answers if they help and unmark them if they provide no help
你好,我记得MapiRule这个例子在用的时候,必须重启手机才能生效,不知道有没有办法让他不重启就生效? 就是因为这个原因,所以我之前才没用 MapiRule,而使用IMAPIAdviseSink.谢谢. -
是的,是要重启的。如果要用mapi来做,IMsgStore::OpenEntry 来打开它返回一个IMessage对象,可以从IMessage对中得到你想要的信息。这里有一个大概的示例:
http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesnative/thread/b0d4d6b8-819f-4744-b82b-4784a40e3f24
Please remember to mark the replies as answers if they help and unmark them if they provide no help -
是的,是要重启的。如果要用mapi来做,IMsgStore::OpenEntry 来打开它返回一个IMessage对象,可以从IMessage对中得到你想要的信息。这里有一个大概的示例:
谢谢,我就是不想要用重启啊,因为是自动系统,不能重启的,所以只能找我上面说的IMAPIAdviseSink来实现了,不过收到的数据没有发送者电话号码这一项的.不知道有没有办法获取?
http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesnative/thread/b0d4d6b8-819f-4744-b82b-4784a40e3f24
Please remember to mark the replies as answers if they help and unmark them if they provide no help -
可以获取到你想到的LPNOTIFICATION中的数据,在OnNotify函数中,有一个参数就是LPNOTIFICATION,可以从这里面获取下面的结构的值:
typedef struct _NEWMAIL_NOTIFICATION
{
ULONG cbEntryID;
LPENTRYID lpEntryID;
ULONG cbParentID;
LPENTRYID lpParentID;
ULONG ulFlags;
LPTSTR lpszMessageClass;
ULONG ulMessageFlags;
} NEWMAIL_NOTIFICATION;
下面的链接中包含一个示例,请参考:
http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesnative/thread/b0d4d6b8-819f-4744-b82b-4784a40e3f24
Please remember to mark the replies as answers if they help and unmark them if they provide no help- 已标记为答案 Guang-Ming Bian - MSFTModerator 2009年10月22日 3:42
-
可以获取到你想到的LPNOTIFICATION中的数据,在OnNotify函数中,有一个参数就是LPNOTIFICATION,可以从这里面获取下面的结构的值:
typedef struct _NEWMAIL_NOTIFICATION
{
ULONG cbEntryID;
LPENTRYID lpEntryID;
ULONG cbParentID;
LPENTRYID lpParentID;
ULONG ulFlags;
LPTSTR lpszMessageClass;
ULONG ulMessageFlags;
} NEWMAIL_NOTIFICATION;
下面的链接中包含一个示例,请参考:
http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesnative/thread/b0d4d6b8-819f-4744-b82b-4784a40e3f24
Please remember to mark the replies as answers if they help and unmark them if they provide no help
你好,这个就是我上面说的只能获取到文本内容(lpszMessageClass),不能获取到发送者电话号码啊. -
你看了我给你的示例了吗:
下面的链接中包含一个示例,请参考:
http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesnative/thread/b0d4d6b8-819f-4744-b82b-4784a40e3f24
上面会得到lpEntryID,通过这个lpEnryID, 用IMsgStore::OpenEntry 得到IMessage对象,这个对象里面包括电话内容。
Please remember to mark the replies as answers if they help and unmark them if they provide no help- 已标记为答案 anyjoy 2009年10月27日 2:14