首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Windows Mobile >

windows mobile 下怎么得知有电话和短信来了?

2012-01-31 
windows mobile 下如何得知有电话和短信来了???最好是能提供源代码或者把整个实现的过程讲清楚啊在线等两

windows mobile 下如何得知有电话和短信来了???
最好是能提供源代码

或者把整个实现的过程讲清楚啊

在线等两小时!

[解决办法]
The State and Notifications Broker
在snapi.h里找找
[解决办法]
mapirule这个例子程序可以看下,处理短消息的。

电话需要注册系统回调,

HLINEAPP hLineApp;
DWORD dwNumDevs = 0;


VOID CALLBACK lineCallbackFuncMakeCall (
DWORD hDevice, 
DWORD dwMsg, 
DWORD dwCallbackInstance,
DWORD dwParam1, 
DWORD dwParam2, 
DWORD dwParam3
)
{
switch (dwMsg)
{
case LINE_APPNEWCALL:
break;
case LINE_REPLY:
SetEvent(callevent);
break;
case LINE_CALLSTATE:
{
switch (dwParam1)
{
…………
}
break;
case LINE_CALLINFO:
break;
default:
break;
}
}

lineInitialize (&hLineApp, NULL, (LINECALLBACK) lineCallbackFuncMakeCall, NULL, &dwNumDevs);
…………
…………
[解决办法]
得知短信来了可以使用MessageInterception,这是我之前写的代码,你可以参考一下
using Microsoft.WindowsMobile.PocketOutlook.MessageInterception;
MessageInterceptor smsInterceptor;
bool flag = false;
void Sms_Received(object sender, MessageInterceptorEventArgs e)
{
flag = true;
}
public override bool NotifyMessageCome(int timeout)
{
StopWatch sw = new StopWatch();
sw.Start();
smsInterceptor = new MessageInterceptor();
smsInterceptor.MessageReceived += new MessageInterceptorEventHandler(Sms_Received);
this.flag = false;
while (sw.Elapsed <= TimeSpan.FromSeconds(timeout))
{
if (flag)
{
smsInterceptor.Dispose();
sw.Stop();
AsusLog.Logger.Addlog(AsusLog.INFO.UIALKeyInfo, "One message comes");
System.Threading.Thread.Sleep(3000);
return true;
}
AsusLog.Logger.Addlog(AsusLog.INFO.AreaLibNormal, "Waiting for message");
System.Threading.Thread.Sleep(1000);
System.Windows.Forms.Application.DoEvents();
}
AsusLog.Logger.Addlog(AsusLog.INFO.AreaLibFail, "Timeout ,No message is received !");
return false;
}

热点排行