- 浏览: 176792 次
- 性别:
- 来自: 南京
文章分类
最新评论
-
zhong504989:
你好。。请问你解决了么?我刚开始搞wap开发,用xhtml来, ...
ASP.NET Mobile Web Form 怎么设置背景图呢? -
xiaoqiang2008:
后台接收代码最好是用java写的
Windows Mobile 上传文件到服务器 -
xiaoqiang2008:
有后台接收的代码吗?能否贴上来看看,谢谢!
Windows Mobile 上传文件到服务器 -
guowee:
大家可以试着用一下ATL的HTML控件,不错的。
Windows mobile HTMLCtrl can not support WML ? -
guowee:
注意: 监控的文件夹名称最后不能有 \
windows mobile 监控 文件夹
1. Fisrt Set the Following Class that process Notification
and you can re-write Function Code
ULONG MAPIAdviseSink::OnNotify(ULONG cNotif, LPNOTIFICATION lpNotifications)
run this Process when a new Message(Mail or SMS) or others operation flag you set.
class MAPIAdviseSink : public IMAPIAdviseSink
{
public:
MAPIAdviseSink();
virtual ULONG OnNotify(ULONG cNotif, LPNOTIFICATION lpNotifications);
virtual ULONG AddRef() { return ++refs; }
virtual HRESULT QueryInterface( REFIID iid, void ** ppvObject) { return E_NOTIMPL; }
virtual ULONG Release();
HRESULT prevResult;
private:
ULONG refs;
};
MAPIAdviseSink *pAdviseSink;
MAPIAdviseSink::MAPIAdviseSink(): refs(0)
{
}
ULONG MAPIAdviseSink::OnNotify(ULONG cNotif, LPNOTIFICATION lpNotifications)
{
//ToDO: rewrite here...
AfxMessageBox(TEXT("new message in"));
/*********************************/
HRESULT hr;
ICEMAPISession * pSession = NULL;
hr = MAPIInitialize(NULL);
hr = MAPILogonEx(0, NULL, NULL, 0, (LPMAPISESSION *)&pSession);
/*****************************/
static const SizedSPropTagArray (2, spta) = { 2, PR_DISPLAY_NAME, PR_ENTRYID };
SRowSet *prowset = NULL;
CComPtr ptbl;
CComPtr pStore;
// Get the table of accounts
hr = pSession->GetMsgStoresTable(0, &ptbl);
// set the columns of the table we will query
hr = ptbl->SetColumns((SPropTagArray *) &spta, 0);
while (TRUE)
{
// Free the previous row
FreeProws (prowset);
prowset = NULL;
hr = ptbl->QueryRows (1, 0, &prowset);
if ((hr != S_OK) || (prowset == NULL) || (prowset->cRows == 0))
return -1;
ASSERT (prowset->aRow[0].cValues == spta.cValues);
SPropValue *pval = prowset->aRow[0].lpProps;
ASSERT (pval[0].ulPropTag == PR_DISPLAY_NAME);
ASSERT (pval[1].ulPropTag == PR_ENTRYID);
if (!_tcscmp(pval[0].Value.lpszW, TEXT("SMS")))
{
// Get the Message Store pointer
hr = pSession->OpenMsgStore(0, pval[1].Value.bin.cb, (LPENTRYID)pval[1].Value.bin.lpb, 0, 0, &pStore);
/**********************/
static const SizedSSortOrderSet(1, sortOrderSet) = { 1, 0, 0, { PR_MESSAGE_DELIVERY_TIME, TABLE_SORT_DESCEND } };
static const SizedSPropTagArray (3, spta) = { 3, PR_SENDER_NAME, PR_SUBJECT, PR_MESSAGE_DELIVERY_TIME };
HRESULT hr = S_OK;
LPENTRYID pEntryId = NULL;
ULONG cbEntryId = 0;
CComPtr pFolder;
CComPtr ptbl;
ULONG ulObjType = 0;
SRowSet *prowset = NULL;
// Get the inbox folder
hr = pStore->GetReceiveFolder(NULL, MAPI_UNICODE, &cbEntryId, &pEntryId, NULL);
// 2 we have the entryid of the inbox folder, let's get the folder and messages in it
hr = pStore->OpenEntry(cbEntryId, pEntryId, NULL, 0, &ulObjType, (LPUNKNOWN*)&pFolder);
// 3 From the IMAPIFolder pointer, obtain the table to the contents
hr = pFolder->GetContentsTable(0, &ptbl);
// 4 Sort the table that we obtained. This is determined by the sortOrderSet variable
hr = ptbl->SortTable((SSortOrderSet *)&sortOrderSet, 0);
// 5 Set the columns of the table we will query. The columns of each row are determined by spta
hr = ptbl->SetColumns ((SPropTagArray *) &spta, 0);
// now get first message in the table
// Free the previous row
FreeProws (prowset);
prowset = NULL;
hr = ptbl->QueryRows (1, 0, &prowset);
if ((hr != S_OK) || (prowset == NULL) || (prowset->cRows == 0))
return -1;
ASSERT (prowset->aRow[0].cValues == spta.cValues);
SPropValue *pval = prowset->aRow[0].lpProps;
// 6 Get the three properties we need: Sender name, Subject, and Delvery time.
ASSERT (pval[0].ulPropTag == PR_SENDER_NAME);
ASSERT (pval[1].ulPropTag == PR_SUBJECT);
ASSERT (pval[2].ulPropTag == PR_MESSAGE_DELIVERY_TIME);
LPCTSTR pszSender = pval[0].Value.lpszW;
LPCTSTR pszSubject = pval[1].Value.lpszW;
SYSTEMTIME st = {0};
FileTimeToSystemTime(&pval[2].Value.ft, &st);
// 7 Pass the parameters to a function to archive (this function is not written)
//hr = AppendToFile(pszFilename, pszSender, pszSubject, st);
AfxMessageBox(pszSubject);
/**********************/
}
}
/*****************************/
hr = pSession->Logoff(0, 0, 0);
pSession->Release();
pSession = NULL;
MAPIUninitialize();
/*********************************/
AfxMessageBox(lpNotifications->info.newmail.lpszMessageClass);
return 0;
}
ULONG MAPIAdviseSink::Release()
{
return 0;
}
2. the code following put on your main Program to set
what kinds of Notification that you want to Process.
you can modify operation flag at
hr = pStore->Advise(0, NULL, fnevObjectCreated | fnevNewMail |
fnevObjectMoved | fnevObjectDeleted,pAdviseSink,
&m_ulAdviseConnection);
for Example: the upper code we set opFlags when SMS Created, NewMail, Moved, Deleted
it will call
MAPIAdviseSink::OnNotify to Process this new Message.
it is an Event-Driven Method.
HRESULT SaveMessages(IMsgStore *pStore, LPCTSTR pszFilename);
//HRESULT SaveSmsMessages(IMAPISession *pSession, LPCTSTR pszFilename);
HRESULT SaveSmsMessages(IMAPISession *pSession, LPCTSTR pszFilename)
{
static const SizedSPropTagArray (2, spta) = { 2, PR_DISPLAY_NAME, PR_ENTRYID };
HRESULT hr;
SRowSet *prowset = NULL;
CComPtr ptbl;
CComPtr pStore;
//---------------------
//IMAPIAdviseSink *pAdviseSink = NULL;
//ULONG m_ulAdviseConnection;
////HrThisThreadAdviseSink(new MyMsgStoreAdviseSink(),&msgStoreAdviseSink);
//hr = pSession->Advise(0, NULL, fnevNewMail | fnevObjectMoved ,
(LPMAPIADVISESINK)pAdviseSink, &m_ulAdviseConnection);
//
//if(hr == S_OK)
//{
// LPNOTIFICATION lpNotifications = NULL;
// ULONG res = pAdviseSink->OnNotify(0, lpNotifications);
// if(res != 0)
// AfxMessageBox(L"pAdviseSink->OnNotify FAIL");
// AfxMessageBox(L"pass");
// pAdviseSink->Release();
//}else{
// AfxMessageBox(L"pSession->Advise Fail");
//}
//---------------------
// Get the table of accounts
hr = pSession->GetMsgStoresTable(0, &ptbl);
//CHR(hr);
// set the columns of the table we will query
hr = ptbl->SetColumns((SPropTagArray *) &spta, 0);
//CHR(hr);
while (TRUE)
{
// Free the previous row
FreeProws (prowset);
prowset = NULL;
hr = ptbl->QueryRows (1, 0, &prowset);
if ((hr != S_OK) || (prowset == NULL) || (prowset->cRows == 0))
break;
ASSERT (prowset->aRow[0].cValues == spta.cValues);
SPropValue *pval = prowset->aRow[0].lpProps;
ASSERT (pval[0].ulPropTag == PR_DISPLAY_NAME);
ASSERT (pval[1].ulPropTag == PR_ENTRYID);
if (!_tcscmp(pval[0].Value.lpszW, TEXT("SMS")))
{
// Get the Message Store pointer
hr = pSession->OpenMsgStore(0, pval[1].Value.bin.cb, (LPENTRYID)pval[1].Value.bin.lpb, 0, 0, &pStore);
//CHR(hr);
//*************************************************
pAdviseSink = new MAPIAdviseSink();
ULONG m_ulAdviseConnection=0;
hr = pStore->Advise(0, NULL, fnevObjectCreated | fnevNewMail |
fnevObjectMoved | fnevObjectDeleted,pAdviseSink,
&m_ulAdviseConnection);
if(hr == S_OK)
{
}else{
AfxMessageBox(L"pSession->Advise Fail");
}
//*************************************************
//SaveMessages(pStore, pszFilename);
}
}
Error:
FreeProws (prowset);
return hr;
}
/*
HRESULT SaveMessages(IMsgStore *pStore, LPCTSTR pszFilename)
{
static const SizedSSortOrderSet(1, sortOrderSet) = { 1, 0, 0, { PR_MESSAGE_DELIVERY_TIME, TABLE_SORT_DESCEND } };
static const SizedSPropTagArray (3, spta) = { 3, PR_SENDER_NAME, PR_SUBJECT, PR_MESSAGE_DELIVERY_TIME };
HRESULT hr = S_OK;
LPENTRYID pEntryId = NULL;
ULONG cbEntryId = 0;
CComPtr pFolder;
CComPtr ptbl;
ULONG ulObjType = 0;
SRowSet *prowset = NULL;
// 1 First retrieve the ENTRYID of the Inbox folder of the message store
// Get the inbox folder
hr = pStore->GetReceiveFolder(NULL, MAPI_UNICODE, &cbEntryId, &pEntryId, NULL);
//CHR(hr);
// 2 we have the entryid of the inbox folder, let's get the folder and messages in it
hr = pStore->OpenEntry(cbEntryId, pEntryId, NULL, 0, &ulObjType, (LPUNKNOWN*)&pFolder);
//CHR(hr);
ASSERT(ulObjType == MAPI_FOLDER);
// 3 From the IMAPIFolder pointer, obtain the table to the contents
hr = pFolder->GetContentsTable(0, &ptbl);
//CHR(hr);
// 4 Sort the table that we obtained. This is determined by the sortOrderSet variable
hr = ptbl->SortTable((SSortOrderSet *)&sortOrderSet, 0);
//CHR(hr);
// 5 Set the columns of the table we will query. The columns of each row are determined by spta
hr = ptbl->SetColumns ((SPropTagArray *) &spta, 0);
//CHR(hr);
// now iterate through each message in the table
while (TRUE)
{
// Free the previous row
FreeProws (prowset);
prowset = NULL;
hr = ptbl->QueryRows (1, 0, &prowset);
if ((hr != S_OK) || (prowset == NULL) || (prowset->cRows == 0))
break;
ASSERT (prowset->aRow[0].cValues == spta.cValues);
SPropValue *pval = prowset->aRow[0].lpProps;
// 6 Get the three properties we need: Sender name, Subject, and Delvery time.
ASSERT (pval[0].ulPropTag == PR_SENDER_NAME);
ASSERT (pval[1].ulPropTag == PR_SUBJECT);
ASSERT (pval[2].ulPropTag == PR_MESSAGE_DELIVERY_TIME);
LPCTSTR pszSender = pval[0].Value.lpszW;
LPCTSTR pszSubject = pval[1].Value.lpszW;
SYSTEMTIME st = {0};
FileTimeToSystemTime(&pval[2].Value.ft, &st);
// 7 Pass the parameters to a function to archive (this function is not written)
//hr = AppendToFile(pszFilename, pszSender, pszSubject, st);
//AfxMessageBox(pszFilename);
//AfxMessageBox(pszSender);
AfxMessageBox(pszSubject);
//CHR(hr);
}
Error:
FreeProws (prowset);
MAPIFreeBuffer(pEntryId);
return hr;
}
*/
void CSYDlg::OnBnClickedButton1()
{
HRESULT hr;
ICEMAPISession * pSession = NULL;
hr = MAPIInitialize(NULL);
hr = MAPILogonEx(0, NULL, NULL, 0, (LPMAPISESSION *)&pSession);
SaveSmsMessages(pSession, L"TestFileName");
hr = pSession->Logoff(0, 0, 0);
pSession->Release();
pSession = NULL;
}
if you want to know Read SMS can ref:
mobile read sms 透過MAPI
it tell WHY you can not use SMSOPEN(...) to get incoming Message
发表评论
-
Windows mobile 菜单(Menu Bar) 更改解决方案
2010-04-07 09:06 2523Windows Mobile 菜单(Menu Bar,C ... -
Windows CE/Windows Mobile开发常见问题解答
2009-12-17 14:44 18351.怎样在一个控件获得 ... -
WM/PPC程序与控制面板命令参数
2009-12-17 14:39 1847不完全正确,不过值得参考: WINDOWS目录下的程序(中英 ... -
PC中如何判断网络已经连接或者断开
2009-12-17 14:38 1667在PPC的开发中有时需要判断网络什么时候连接,什么时候断开,并 ... -
PPC中如何找到正在使用中的网络(源代码)
2009-12-17 14:36 962《PPC中如何判断网络已 ... -
在Windows mobile中如何更改短信会话模式
2009-11-04 11:57 1922在windows mobile 中如何更改短信的会话模式呢。 ... -
GPS短信接收 与 导航软件通信
2009-10-29 14:10 1504这是开这个博客的第一篇文章, 在这里开博客主要是为了写一下以前 ... -
windows mobile MAPI Set EntryID
2009-08-17 16:02 0void CSmsMessage::SetEntryID(SB ... -
控制Windows Mobile手机的键盘操作
2009-08-07 11:59 2716如何控制Windows Mobile 手 ... -
WinCE Dialog 添加 Scrollbar
2009-06-22 16:53 4268如何在WinCE上设置滚动条? 最近再搞winCE ... -
Windows mobile HTMLCtrl can not support WML ?
2009-06-01 10:58 1405最近在使用windows mobile上的HTMLCtrl的时 ... -
Windows Mobile 今日插件开发
2009-05-27 16:06 4002http://blog.csdn.net/doubleblue ... -
Developing in C++ with the HTML Viewer Control
2009-05-22 09:34 2228[转载自MSDN:http://msdn.microsoft. ... -
Mobile开发之路_之小总结
2009-04-18 22:20 17871,从那种基本类中继承的函数 变异时都会自动被调用 2,vo ... -
Windows Mobile中使用htmlCtrl控件
2009-04-18 22:16 2401在某些特殊的应用场合,我们很想要一个类似IE功能的模块,定制自 ... -
推荐几篇关于Windows Mobile程序安装包制作的文章
2009-03-13 15:39 3502转载至:http://www.cnblogs.com/upt ... -
Hiding the Progress Bar of a .NET 2.0 CF WebBrowse
2009-03-11 14:08 1558[转载自:http://www.chriskarch ... -
如何处理屏幕方向改变
2009-03-01 10:02 1170在Windows Mobile平台的应用程序开发过程中, ... -
Windows Mobile中GPRS连接网络
2009-03-01 09:58 1695Windows Mobile程序中如果 ... -
Outgoing SMS intercepting
2009-02-27 14:33 1067http://social.msdn.microsoft.co ...
相关推荐
"Laravel开发-sms-notification"主题涵盖的内容主要是如何在Laravel项目中集成和使用短信通知服务。 首先,Laravel的通知系统是基于事件驱动的,它允许开发者通过简单的接口发送多种类型的通知,包括邮件、短信、推...
本文将深入探讨“Laravel开发-laravel-mobile-notification”这一主题,特别是如何利用Laravel/Lumen发送推送通知到移动设备,包括Apple Push Notification (APN) 和 Google Cloud Messaging (GCM)。 首先,Laravel...
在本文中,我们将深入探讨如何在 Laravel 框架中使用 Dhiraagu SMS 网关来实现批量发送短信的功能。Laravel 是一个流行的开源 PHP 框架,以其优雅的语法和强大的功能深受开发者喜爱。Dhiraagu 是马尔代夫的一家电信...
首先,了解`Notification`的概念。通知通常分为几种类型,例如弹窗通知、声音提示、震动反馈等,这些都用于吸引用户的注意力。在Windows Mobile中,我们可以利用API和C#的强大力量,定制适合不同场景的通知样式。 1...
而 `laravel-notification-channel-turbosms` 是 Laravel 的一个通知频道,专门用于集成 TurboSMS 服务,允许开发者通过 SMS 来发送通知。 首先,理解 `laravel-notification-channel-turbosms` 的工作原理至关重要...
在Android开发中,`Notification`是用户界面的一个关键组件,用于在状态栏向用户显示重要的信息或提醒。在"疯狂Android中有关Notification的简单例子"这个主题中,我们将深入探讨`Notification`的基本概念、创建过程...
Ajax-SMS-based-Notification-system.zip,通知系统是一个项目,它将帮助教师通知学生任何重要的信息,如时间表的变化,任何即将举行的研讨会和其他信息。此信息将通过短信共享,ajax代表异步javascript和xml。它是...
Play midi files and receive notification callbacks to easily implement repeating music. No special controls needed it’s done through API!
在Android开发中,Notification是应用与用户交互的重要方式,它能够在状态栏显示消息,即使用户不在应用程序中也能接收到信息。本教程将深入探讨Notification的最新用法,如何实现通知栏常驻,以及如何利用big View...
在本文中,我们将深入探讨如何在 Laravel 开发中利用 `laravel-notification-channel-voicecombg` 扩展包实现 VoiceCom BG 通知频道。Laravel 是一个流行的 PHP 框架,它为开发者提供了优雅的方式来构建 web 应用...
本示例着重讲解了如何创建和使用不同类型的Notification,包括普通Notification、折叠式Notification以及悬挂式Notification,并涉及到Notification的显示等级设置。 1. **普通Notification**: 这是最基础的...
在Android开发中,`Notification`是用户界面的一个关键组件,用于在状态栏中显示消息,即使应用程序在后台运行,也能提醒用户有新的活动或事件发生。`Notification`的设计旨在提供一致且非侵入性的用户体验,使得...
在Android开发中,Notification是应用与用户交互的重要方式,它能够在状态栏中显示信息,即使用户不在应用程序中也能提醒用户有新的活动或消息。本文将深入解析Android Notification的工作原理、设计模式以及如何...
在Android系统中,Notification是应用与用户交互的重要方式,它能提醒用户有新的事件或信息需要处理,即使应用不在前台运行。Notification分为多种类型,包括Toast、StatusBar Notification和Dialog Notification,...
在Android开发中,`Notification`是系统提供的一种机制,它能够在状态栏或者顶部通知栏显示信息,即使应用在后台运行或者被用户关闭,仍然能够向用户传达关键信息。本示例"Notification顶部通知栏demo"显然是为了...
在Android开发中,Notification是应用与用户交互的重要方式之一,特别是在后台运行时,它能向用户提供关键信息,而不会打扰到他们的主要活动。"Notification Demo"是一个示例项目,专门展示了如何在Android应用中...
在Ext JS中,“Notification”插件是用于显示通知消息的一个组件,它可以帮助开发者在用户界面上创建吸引人且易于理解的提示信息。本文将深入探讨Ext JS Notification插件的使用方法、功能特性以及如何集成到项目中...
在Android系统中,Notification是应用与用户交互的重要方式之一,特别是在后台运行时,它能向用户提供关键信息。常驻Notification是指即使用户关闭了应用程序,Notification仍然保留在通知栏,持续提醒用户有未处理...