分类目录
文章索引模板
20070730 openmoko GPE Phone Edition - 五月 2, 2008 by yippee

20070730 openmoko GPE Phone Edition
http://www.yippeesoft.com

openmoko是世界上第一个开源的手机操作系统,同样是基于linux的系统,看内核启动好像是在A780的硬件基础上开发的,界面和苹果有的一拼,现在基本已经完成,整机在测试中,官方称在7月9日可以接受硬件订购,有两种版本,分标准版(软件开发者)和高级版(硬件),希望在大A上也可以安装这个系统啊。网站上还有一个视频,是和A780通话的测试。和moto的ezx不同,openmoko是一个开放的linux系统,用户可以自由更改系统, openmoko使手机更像一部linux系统的电脑。

http://www.openmoko.com/

GPE Phone Edition
幾個月前,[openmoko] 對世人投下一顆震撼彈,是的,Linux phone 不再只有 Linux Kernel 才能取得 source code,內部的軟體元件也終將可成為自由軟體,包含 AT command 介面甚至是 baseband,而之前的 blog [偉哉!Qtopia 4.2] 也提到 Trolltech 的 Qtopia Phone 4.2 將大部分的軟體以 GPL 授權釋出,不過那還是缺乏自由軟體實做的 GSM stack。[GPE Phone Edition] 是本週發佈的新計畫,如其簡介 "GTK based solutions for mobile phones" 所暗示,以既有 [GPE: The GPE Palmtop Environment] 的基礎,再行擴充與 GSM/GPRS 相關的元件,雖然完成度還有待加強,但可以說是目前完整 GSM phone 的自由軟體專案。

從 [GPE Phone Edition] 的 [專案網頁] 可看到許多開發者是來自中國大陸,他們是法國電信中國公司的開發人員,根據 [Cavendish Qi] 的說法,開發者之一的余義軍 (yijun yu),曾是 Trolltech 北京辦事處的第一名技術人員,離開 Trolltech 後服務於法國電信,看來 [GPE Phone Edition] 是相當值得期待的計畫,目前相關的 source code 也已經上線,可透過 SVN 取得最新發展的程式碼,另外也可透過 VMware 來模擬系統,運作畫面如下:

現在 [OpenEmbedded] 也正式支援 [GPE Phone Edition],可參考 packages/gpephone 目錄,並且檔案 "gpe-session-scripts-phone/phonesession" 暗示了系統的設計也採用 X Window System 與 [Matchbox window manager],最近的 OLPC、Nokia 770,以及 OpenMoko 都採用類似的設計,關於 GSM/GPRS 的部份可參考 CMS92/gsmMux 與 phoneserver 的實做。

GPE Phone Edition (G(PE)²) is meant to develop a GTK / GPE based a software stack for mobile Linux devices, especially mobile phones. Please also see our mission statement for more details about the goal and how to reach them.

It contains a set of applications, libraries and documentation to build software to be used for mobile phones and similar devices.

It is provided as an open source project so that everyone has free access to use, develop, and learn from this example software implementation. Of course it is possible to join the project and contribute to it. For details about the current development status, contributing and released files please take a look at the development website.

GPE Phone Edition is not meant to be a ready made product for a particular device or purpose. You use it at your own risk without any warranty. The software is devided into several sub-projects that are distributed under open source licenses, either GPL, LGPL or a BSD-like license originating from the LiPS Forum.

http://projects.linuxtogo.org/frs/?group_id=12&release_id=48

http://www.openembedded.org/
OpenEmbedded is a full-featured development environment allowing users to target a wide variety of devices. Supporting multiple build, release paths and configurations, OpenEmbedded extends the capabilities of your build and release engineers. OpenEmbedded uses compilation and configuration caching at most levels to increase developer productivity.

OpenEmbedded is a tool which allows developers to create a fully usable Linux base for various embedded systems. It has been designed to be able to handle different hardware architectures, support multiple releases for those architectures, and utilize tools for speeding up the process of recreating the base after changes have been made. Currently it can run on any Linux distribution, and plans are in place to allow it to work under Windows.

OpenEmbedded uses the Bitbake task executor in combination with the OpenEmbedded metadata to do all of the above, and it\’s using monotone as its version control system.

OpenEmbedded is the successor of the great OpenZaurus project. Basically OpenEmbedded is a build system that can generate (cross-compile) Software packages for embedded targets. This may include Bootloader, Linux and Applications. It started as a dream and BrainStorming, on how this could be done, and it\’s already used in real life.

   *  OpenMoko:
   * open.
   * mobile.
   * free.

OpenMoko is a GNU / Linux based open software development platform. Developers have full access to OpenMoko source and they can tailor their implementations to underlying hardware platforms.

Mobile phones, currently closed and self limited, will rival broadband computers. When based on Open standards, they will deliver ubiquitous computing and vanish.

Ubiquitous computing means more than computing wherever you wander: It means knowing the locale, weaving seamlessly into the local fabric, and vanishing.

Devices disappear when developers have unrestricted access to hardware.

Neo gives you this control for the first time.

We want your mind in OpenMoko. Let’s work together. You’ll have our full support. Now, Free Your Phone.
VMware virtual machine image:

The virtual machine has a GSM modem configured as /dev/GSM-Modem. In case you happen to have a mobile phone connected to your workstation (serial cable, USB cable, Bluetooth or PCMCIA card) and this modem conforms to GSM standards then you should be able to use the platform\’s phone server with it. This should enable SIM phonebook, SMS and voice calls.

OpenMoko做为第一款完全基于开放源码构建的移动通讯平台,从其推出之日起,就已经引起了各界的关注。根据OpenMoko的计划,整个手机将分为三个阶段推出,在Phase 0阶段,将主要面向Free Software Developer,以供开发和测试。据我目前所知,中国大陆好像没有人获得样机和开发板。因此,在正式发售之前,对于Emulator的渴望可能是我唯一可以期待的事情了。

日前在Planet of Open Moko上看到了Emulator释出的消息,于是利用上午的时间安装了一下,以下为安装过程中的一些注意事项以及屏幕的Snapshot.

需要提前安装的软件包:

  1. SDL: 主要供Qemu显示图形界面使用
  2. lynx: 主要在下载镜像文件的openmoko/download.sh中使用
  3. netpbm:这是一个图形转换的工具集,主要用来生成splah

安装大抵可以按照 OpenMoko Wiki上提到顺序来进行,需要注意的是,系统中需要安装Gcc 3.x版本的编译器。我的系统已经升级到了最新版的Ubuntu Feisty, gcc的版本是 4.1.2 , 在configure的时候会出问题。在安装gcc 3.3之后,修改一下configure文件,将cc和host cc对应的值改为gcc-3.3即可进行编译。在编译过程中,会出现一些警告,大家可以不必理会,继续编译即可。

OpenMoko under QEMU
From OpenMoko
Jump to: navigation, search

QEMU can basically be used in three ways to run OpenMoko. Depending on the purpose that you are going to use the emulator for, you should decide on the target platform.

   * PC – OpenMoko can be built to run on regular i386 hardware, 32- or 64-bit and this is probably the fastest way to get OpenMoko running if you want to get an impression of how it looks. In this scenario QEMU would only serve for isolating your OpenMoko installation from your normal system, or, if you\’re not on a UNIX system, QEMU provides a non-intrusive way to get Linux up quickly. More information can be found in the FAQ and here.

   * Integrator/CP – this is the default ARM-based machine that QEMU knows about. This target is used with MACHINE="qemuarm" and it is sufficient to run the original OpenMoko rootfs image, although it doesn\’t emulate any of the Neo1973 Hardware except the very CPU core. Read more in the FAQ.

   * Neo1973 – the QEMU tree available from OpenMoko repositories is also capable of emulating most of the actual Neo1973 hardware, although not all of it at this moment. It is a work-in-progress and when it\’s more mature it is going to be submitted for merging to the main QEMU development tree.

   = Trac简介 =
作者:周光营
—-

Trac是Edgewall公司开发的开源的基于web的轻量级项目管理软件。其官方网站介绍如下:

&leftsign;&leftsign;&leftsign;
Trac is an enhanced wiki and issue tracking system for software development projects. Trac uses a minimalistic
approach to web-based software project management. Our mission is to help developers write great software while
staying out of the way. Trac should impose as little as possible on a team\’s established development process
and policies.

It provides an interface to Subversion, an integrated Wiki and convenient reporting facilities.

Trac allows wiki markup in issue descriptions and commit messages, creating links and seamless references between
bugs, tasks, changesets, files and wiki pages. A timeline shows all project events in order, making the
acquisition of an overview of the project and tracking progress very easy.
&rightsign;&rightsign;&rightsign;

翻译过来:

&leftsign;&leftsign;&leftsign;
Trac是用于软件开发项目的增强的wiki和缺陷跟踪系统。Trac以最简洁的方式实现基于web的软件项目管理。我们的目标是帮助开发者以置身事外的
方式写出伟大的软件。Trac尽量不影响团队已确定的开发步骤和规范。

它提供一个操作subversion的界面,一个集成的wiki以及方便的报表工具。

Trac允许在缺陷描述或者提交信息中使用wiki标记,以便在bug、任务、变更列表、文件和wiki页之间创建链接和无缝引用。时间线可以按顺序显示
项目全部的事件,使得了解项目概况和跟踪进度变动非常容易。
&rightsign;&rightsign;&rightsign;

确实,在实际使用过程中,开发人员需要额外做的事情很少,操作非常简单,极易上手。而对于项目管理人员来说,Trac提供了足够详尽的信息,以便来及时的了解项目的概况、进度、遇到的问题,甚至每一个项目成员的工作情况。在对每个ticket的处理过程中,项目成员的交流信息也可以很好的保留下来。

从ISO9001认证角度看,Trac可以为整个PDCA过程提供很好的支持。具体来说,通过创建Milestone及Ticket来做计划(Plan),开发人员接受Ticket并加以解决(Do),项目管理人员可以通过查看Roadmap、Timeline以及具体Ticket的信息来检查(Check)执行情况,然后进一步通过修改Milestone或者创建并分配新的Ticket来做出相应的处理(Action)。

标签:, ,
20070608 YippeeSMSBK mpx220 短信 备份  SMARTPHONE - 四月 1, 2008 by yippee

20070608 YippeeSMSBK mpx220 短信 备份  SMARTPHONE

http://www.yippeesoft.com

YippeeSMSBK mpx220 短信 备份 SMARTPHONE

短信备份的,用过几个人家的,有的是增量备份,每次生成单独的文件,有的是无法解析发件箱里面的收件人,全部显示成发件人

C# VC2005 SQLITE

完成功能

解析 收件人/发件人 时间 内容

读取收件箱 发件箱

收取之后删除短信SMS

存储于SQLITE

退出时备份

分邮箱浏览

按时间浏览

首先是 WINCE MAPI的问题

然后是VC2005作界面的问题

最后是C# SQLITE的问题

断断续续作了快一个星期

效率实在有些差了。

c#的效率的确比VC要差很多

以前用VC查询一个几十万条记录的SQLITE,速度明显飞快

而c#第一次打开数据库就明显延时严重

标签:, , , , , , ,
20070607 vs2005 smartphone winform diff - 二月 13, 2008 by yippee

20070607 vs2005 smartphone winform
http://www.yippeesoft.com

奇怪的事情
同样的代码,SMARTPHONE就会出错

private void button2_Click(object sender, EventArgs e)
        &leftsign;
            tree.Nodes.Remove(tree.SelectedNode);
        &rightsign;

未处理 System.ArgumentOutOfRangeException
  Message="ArgumentOutOfRangeException"

只好改成
tree.SelectedNode.Remove();

树视图控件中移除当前树节点。

命名空间:System.Windows.Forms
程序集:System.Windows.Forms(在 system.windows.forms.dll 中)

private void treeView1_MouseDown(object sender, MouseEventArgs e)
&leftsign;
   switch(e.Button)
   &leftsign;
      // Remove the TreeNode under the mouse cursor
      // if the right mouse button was clicked.
      case MouseButtons.Right:
         treeView1.GetNodeAt(e.X, e.Y).Remove();
         break;
     
      // Remove the TreeNode under the mouse cursor
      // if the middle mouse button (mouse wheel) was clicked.
      case MouseButtons.Middle:
         treeView1.GetNodeAt(e.X, e.Y).Toggle();
         break;
   &rightsign;
&rightsign;

从树节点集合中移除指定的树节点。

命名空间:System.Windows.Forms
程序集:System.Windows.Forms(在 system.windows.forms.dll 中)

private void button1_Click(object sender, EventArgs e)
&leftsign;
   // If neither TreeNodeCollection is read-only, move the
   // selected node from treeView1 to treeView2.
   if(!treeView1.Nodes.IsReadOnly && !treeView2.Nodes.IsReadOnly)
   &leftsign;
      if(treeView1.SelectedNode != null)
      &leftsign;
         TreeNode tn = treeView1.SelectedNode;
         treeView1.Nodes.Remove(tn);
         treeView2.Nodes.Insert(treeView2.Nodes.Count, tn);
      &rightsign;
   &rightsign;
&rightsign;

using (SQLiteConnection conn = new SQLiteConnection("Data Source=" + path + ";New=False;Compress=False;Synchronous=Off;UTF8Encoding=False;Version=3"))
            &leftsign;
                conn.Open();
                SQLiteCommand cmd = conn.CreateCommand();

               
                cmd.CommandText = "select DISTINCT (box) from sms";
                IDataReader dbReader = cmd.ExecuteReader();

                Cls_SMS_Node clsnodeP;
                while (dbReader.Read())
                &leftsign;
                    clsnodeP = new Cls_SMS_Node(dbReader[0].ToString());
                    clsnodeP.id = -1;
                    tree.Nodes.Add(clsnodeP);
                &rightsign;
                dbReader.Close();

  这段代码每次第二次执行的时候就会出现 unable open database file 错误

标签:, , , , , , , , , ,
20070606 smartphone vs2005 tree-view controls - 二月 10, 2008 by yippee

20070606 smartphone vs2005 tree-view controls
http://www.yippeesoft.com

 create an MFC app using VS2005 for Smartphone. A CTreeCtrl (sitting on a CFormView) is not processing any keyboard input. For example, pressing the arrow keys or Action key does not expand/contract nodes. Am I missing something simple?

By default, CTreeCtrl on Smartphone has limited navigation:

Expand/Collapse node = Action Key
Move focus = Up/Down
Check/Uncheck box = <nothing>

A sugeestion is to override this for Smartphone so that:

Expand/Collapse node = Left/Right key
Move focus = Up/Down
Check/Uncheck box = Action key

Hope that helps.

smartphone开发中遇到的问题,TreeView为什么不响应键盘消息? 按确定不能展开,按上下键不能在节点之间移动..
楼主jun_01(无名小卒)2005-07-03 16:49:52 在 硬件/嵌入开发 / 嵌入开发(WinCE) 提问

总之一句话,   treeView不响应任何键盘消息. 
  替换了它的wndProc,能发现有消息发给它,但它就是没有任何效果   …

4 楼nbcool(载舟之水)回复于 2005-07-07 21:42:57 得分 80

不好意思,下载才有空回答,不过很高兴你找到了正确的方法。 
  这个问题原因有2个。 
  
  1.当前treeview没有获得焦点,或者在当前窗口开了其他窗口后忘记把焦点交回treeview。 
      这个解决办法很简单了,每次SetFocus就行了。或者在 
      DialogBox(…);   or   MessageBox(…); 
      SetFocus(hTreeView); 
      这样就能保证焦点回来。 
      
  2.在DialogBox里建立的TreeView,由于DialogBox会屏蔽一些键盘传送的消息,导致消息无法传给treeview,这种情况有两个办法 
      a.不用DialogBox,而改用窗口。 
      b.就是做子类化了,替换TreeView控件的消息处理过程,我猜你用了这个。但是记得别忽视了焦点的问题,这在SP下比较重要,而PPC显得次要些。 
      LRESULT   CALLBACK   TreeViewProc(   
      HWND   hwnd,   
      UINT   uMsg,   
      WPARAM   wParam,   
      LPARAM   lParam   )   
  &leftsign;   
      switch   (uMsg)   
      &leftsign;   
          case   WM_GETDLGCODE:   
                return   DLGC_WANTMESSAGE;   
      &rightsign;   
      return   CallWindowProc(OldTreeViewProc,   hwnd,   uMsg,   wParam,   lParam);   
  &rightsign; 
  
  HTML   控件也有这个问题。希望你满意这个答案。 

to     nbcool(载舟之水)   ,没想到你是一个很负责的人,呵呵。 
  我就是自己替换treeview的windowProc,然后拦截键盘的上下左右和确定键来完成的。 
  但遇到了很多问题,首先是key_down有的键竟然拦截不到,然后用了key_up,又发现和xbar有冲突。 
  每次按键都会连续收到2次消息,实在没办法,又判断了2次消息之间的时间间隔,总算勉强完成了想要的功能,真的是不爽。 
  而且我后来用到了listview控件,又发现了一些问题,好在有treeview的经验,也用类似的办法勉强搞了出来,实在是怕了。。。 
  
  看到你的WM_GETDLGCODE,我发现应该有用,准备试一下。真是感谢! 
  
  我还遇到了其它一些关于菜单的键盘消息的问题,也在困惑中,真是郁闷呀。

How to: Subclass a TreeView by Using Native Callbacks
This example shows how to subclass a TreeView control to create a NodeMouseClick event, which is not available in the .NET Compact Framework.

The form displays the subclassed TreeView control and information about a clicked node. It shows the a node\’s text and the x and y coordinates of where the TreeView control was clicked, which changes as you click in different places on a node.

This example program is described in detail in Subclassing Controls with a Managed Window Procedure.
To subclass a TreeView control to create a NodeMouseClick event

   1.

      In Microsoft Visual Studio 2005, create a Smart Device Pocket PC project.
   2.

      Add the Win32 helper class to your project. This code is available in How to: Use a Helper Class for Platform Invokes.
   3.

      Add the WinProcHooker class to your project. This code is available in How to: Use a Class for Hooking Windows Procedures.
   4.

      Add the TreeViewBonus class to your project.

标签:, , , , ,
20070606 smartphone vs2005 cemapi  DeleteMessages - 二月 9, 2008 by yippee

20070606 smartphone vs2005 cemapi  DeleteMessages
http://www.yippeesoft.com

//Link with: kernel32.lib user32.lib advapi32.lib msvcrt.lib edkdebug.lib mapi32.lib version.lib edkmapi.lib edkutils.lib addrlkup.lib rulecls.lib edkguid.lib
#include <edk.h>

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE,
                    LPSTR pszCmd, int nCmdShow)
&leftsign;
 LPMAPISESSION  lpSession = NULL;
 LPMDB          lpStore = NULL;
 LPMAPIFOLDER   lpFolder = NULL;
 ULONG          cbEIDFolder = 0;
 LPENTRYID      lpEIDFolder = NULL;
 HRESULT        hr = NULL;
 LPMAPITABLE    lpTable = NULL;
 CHAR           szFolder[MAX_PATH + 1] = &leftsign;0&rightsign;;
 ULONG          ulUIParam = 0;
 LPCIID         lpInterface = NULL;
 ULONG          ulFlags = MAPI_BEST_ACCESS;
 LPSRestriction lpRes = NULL;
 ULONG          lpulCount = NULL;
 LPSRowSet      lpRows = NULL;
 LPMAPIPROP     lpMAPIProp = NULL;
 ENTRYLIST      eidMsg;
 char           szDisplayName[50];
 char           szMess[100];
 
 SizedSPropTagArray(2, Columns) =
 &leftsign;
  2,  // number of properties
  &leftsign;
   PR_ENTRYID,
    PR_DISPLAY_NAME
  &rightsign;
 &rightsign;;
 
 // TO DO: Change Form Name
 sprintf(szDisplayName,"FormName");
 
 hr = MAPIInitialize(NULL);
 if (FAILED(hr))
 &leftsign;
  return 1;
 &rightsign;
 hr = MAPILogonEx(0, "", NULL,
  MAPI_LOGON_UI &line; MAPI_NEW_SESSION &line;  MAPI_EXPLICIT_PROFILE ,
  &lpSession);
 if (FAILED(hr))
 &leftsign;
  MessageBox(NULL,"MAPI Logon failed",NULL,MB_OK);
  goto cleanup;
 &rightsign;
 
 hr = HrOpenExchangePrivateStore(lpSession,&lpStore);
 if (FAILED(hr))
 &leftsign;
  MessageBox(NULL,"Message Store Not Opened",NULL,MB_OK);
  goto cleanup;
 &rightsign;
 strcpy(szFolder, "Top of Information Store\\\\Inbox");
 
 hr = HrMAPIFindFolderEx(lpStore,
  \’\\\\\’,
  szFolder,
  &cbEIDFolder,
  &lpEIDFolder);
 if (FAILED(hr))
 &leftsign;
  MessageBox(NULL,"Inbox Not Found",NULL,MB_OK);
  goto cleanup;
 &rightsign;
 
 hr = HrMAPIOpenFolderEx (lpStore,\’\\\\\’,szFolder,&lpFolder);
 if (FAILED(hr))
 &leftsign;
  MessageBox(NULL,"Inbox Could Not Be Opened",NULL,MB_OK);
  goto cleanup;
 &rightsign;
 
 if (FAILED(hr = lpFolder->GetContentsTable(MAPI_ASSOCIATED,&lpTable)))
 &leftsign;
  MessageBox(NULL,"GetContentsTable Failed",NULL,MB_OK);
  goto cleanup;
 &rightsign;
 if (FAILED(hr = lpTable->SetColumns( (LPSPropTagArray)&Columns,NULL )))
 &leftsign;
  MessageBox(NULL,"SetColumns Failed",NULL,MB_OK);
  goto cleanup;
 &rightsign;
 if (FAILED(hr = HrStringToRestriction(
  "PR_MESSAGE_CLASS = \\"IPM.Microsoft.FolderDesign.FormsDescription\\"",
  NULL,&lpRes)))
 &leftsign;
  MessageBox(NULL,"HrStringToRestriction Failed",NULL,MB_OK);
  goto cleanup;
 &rightsign;
 
 if (FAILED(hr = lpTable->Restrict(lpRes,0L)))
 &leftsign;
  MessageBox(NULL,"Restrict Failed",NULL,MB_OK);
  goto cleanup;
 &rightsign;
 
 if (FAILED(hr = lpTable->GetRowCount(0,&lpulCount)))
 &leftsign;
  MessageBox(NULL,"GetRowCount Failed",NULL,MB_OK);
  goto cleanup;
 &rightsign;
 
 if (lpulCount > 0)
 &leftsign;
  if (FAILED(hr = lpTable->QueryRows(lpulCount,TBL_NOADVANCE,
   &lpRows)))
  &leftsign;
   MessageBox(NULL,"QueryRows Failed",NULL,MB_OK);
   goto cleanup;
  &rightsign;
  
  for (ULONG i=0; i < lpulCount; i++)
  &leftsign;
   if (0 == strcmp(szDisplayName,lpRows->aRow[i].lpProps[1].Value.lpszA))
   &leftsign;
    eidMsg.cValues = 1;
    eidMsg.lpbin   = &lpRows->aRow[i].lpProps[0].Value.bin;
    
    if (FAILED(hr = lpFolder->DeleteMessages(&eidMsg, 0L, NULL,
     MESSAGE_DIALOG)))
    &leftsign;
     sprintf(szMess, "DeleteMessages Failed error %x",hr);
     MessageBox(0L,szMess,"Error",MB_OK);
     goto cleanup;
    &rightsign;
    else
    &leftsign;
     sprintf(szMess, "DeleteMessages Completed with hr = %x",hr);
     MessageBox(0L,szMess,"Information",MB_OK);
    &rightsign;
   &rightsign;
  &rightsign;
 &rightsign;
 else
 &leftsign;
        sprintf(szMess, "No forms Found");
        MessageBox(0L,szMess,"Error",MB_OK);
 &rightsign;
 
cleanup:
 
 if (lpFolder)
 &leftsign;
  lpFolder->Release();
  lpFolder = NULL;
 &rightsign;
 
 if (lpTable)
 &leftsign;
  lpTable->Release();
  lpTable = NULL;
 &rightsign;
 
 if (lpStore)
 &leftsign;
  lpStore->Release();
  lpStore = NULL;
 &rightsign;
 
 if (lpRows)
  FREEPROWS(lpRows);
 
 if (lpSession)
 &leftsign;
  lpSession->Logoff(0, 0, 0);
  ULRELEASE(lpSession);
 &rightsign;
 MAPIUninitialize();
 return 0;
&rightsign;
 

标签:, , , , , ,
20070605 cemapi smartphone vs2005 - 二月 8, 2008 by yippee

HRESULT             hr;
 IMAPISession    *   pSession    =   NULL;
 IMAPITable      *   pTable      =   NULL;
 SRowSet         *   psrs        =   NULL;
 IMsgStore       *   pStore      =   NULL;
 ULONG               rgTags[]    =   &leftsign; 1, PR_CE_IPM_INBOX_ENTRYID &rightsign;;

 ULONG               cValues     =   0;
 SPropValue      *   rgprops     =   NULL;
 SPropValue      *   rgpropsMsg  =   NULL;
 LPMAPIFOLDER        pfldrDrafts =   NULL;
 IMessage        *   pmsg        =   NULL;

 // First logon to the store.
 hr = MAPILogonEx(NULL, NULL, NULL, NULL, &pSession);
 EXIT_ON_FAILED(hr);

 // Get the message stores table
 hr = pSession->GetMsgStoresTable(MAPI_UNICODE, &pTable);
 EXIT_ON_FAILED(hr);

 while (SUCCEEDED(pTable->QueryRows(1, 0, &psrs)))
 &leftsign;
  // Check number of rows returned. Since the above call only asks for one,
  // anything else means we are at the end of the table
  if (1 != psrs->cRows)
  &leftsign;
   break;
  &rightsign;

  // Make sure we got the props we need
  if ((1 > psrs->aRow[0].cValues)&line;&line;(PR_ENTRYID != psrs->aRow[0].lpProps[0].ulPropTag))
  &leftsign;
   MessageBox( L"Store missing PR_ENTRYID!", L"Error", MB_OK);
   hr = E_FAIL;
   break;
  &rightsign;

  // Open this message store
  hr = pSession->OpenMsgStore(NULL,
   psrs->aRow[0].lpProps[0].Value.bin.cb,
   (ENTRYID *)psrs->aRow[0].lpProps[0].Value.bin.lpb,
   NULL,
   0,
   &pStore);
  EXIT_ON_FAILED(hr);

  // Now get the Drafts folder. In order for a message to be sent by MAPI, it must be created
  // in the Drafts folder
  hr = pStore->GetProps((SPropTagArray *)rgTags, MAPI_UNICODE, &cValues, &rgprops);
  EXIT_ON_FAILED(hr);

  ASSERT(rgprops);
  ASSERT(rgprops[0].ulPropTag == PR_CE_IPM_INBOX_ENTRYID);
  //SaveMessages(pStore,L"1");
  hr = pStore->OpenEntry(rgprops[0].Value.bin.cb,
   (LPENTRYID)rgprops[0].Value.bin.lpb,
   NULL,
   MAPI_MODIFY,
   NULL,
   reinterpret_cast <IUnknown **>(&pfldrDrafts));
  EXIT_ON_FAILED(hr);

  ASSERT(pfldrDrafts);

  //LPMAPITABLE  pTable = NULL;
  //LPSRowSet pRows = NULL;
  //ULONG   ulNumCols = 1;
  //HRESULT hr;
  //&#63839;&#46413;乖&#52460;矜&#63787;&#49343;&#54820;Entry ID橄昑
  SizedSPropTagArray(1/*ulNumCols*/, Columnss) =
  &leftsign;
   1,
   PR_ENTRYID 
  &rightsign;;
  hr = pfldrDrafts->GetContentsTable(0, &pTable);
  if(hr != S_OK)
  &leftsign;
   MessageBox(_T("d0 error"));
   return;
  &rightsign;
  hr = pTable->SetColumns((LPSPropTagArray)&Columnss, 0);
  if(hr != S_OK)
  &leftsign;
   MessageBox(_T("d1 error"));
   return;
  &rightsign;
  int MessageNum=0;
  while(SUCCEEDED(pTable->QueryRows(1, 0, &psrs)))
  &leftsign;
   LPMESSAGE pMsg = NULL;
   ULONG ulMesageType;
   //繫&#48277;OpenEntry&#49343;&#54820;IMessage&#46756;蹶
   //MessageBox(_T("xxxx"));
   hr = pfldrDrafts->OpenEntry( psrs->aRow[0].lpProps[0].Value.bin.cb,
    (LPENTRYID)psrs->aRow[0].lpProps[0].Value.bin.lpb,
    NULL,
    MAPI_BEST_ACCESS,
    &ulMesageType,
    (LPUNKNOWN*)&pMsg);
  
   if(hr == S_OK)
   &leftsign;
    MessageNum++;
    MessageBox(_T("S_OK"));
   &rightsign;
   else if(hr == MAPI_E_NO_ACCESS)
   &leftsign;
    MessageBox(_T("MAPI_E_NO_ACCESS"));
   &rightsign;
   else
    MessageBox(_T("error"));

   HRESULT hr = E_FAIL;
   SPropValue * rgprops = NULL;
   ULONG rgTags[] = &leftsign;3, PR_MSG_STATUS, PR_SUBJECT, PR_IMPORTANCE&rightsign;;
   ULONG cCount = 0;

   // Get properties from the message.
   hr = pMsg->GetProps((LPSPropTagArray) rgTags, MAPI_UNICODE, &cCount, &rgprops);

   // Access the properties that were just retrieved.
   if (SUCCEEDED(hr))
   &leftsign;       
    // Check that the ulPropTag member of each property value is the property type requested and is not PT_ERROR.
    if (rgprops[0].ulPropTag == PR_MSG_STATUS)
    &leftsign;
     MessageBox(rgprops[0].Value.lpszW);
    &rightsign;

    if (rgprops[1].ulPropTag == PR_SUBJECT)
    &leftsign;
     MessageBox( rgprops[1].Value.lpszW);
    &rightsign;

    if (rgprops[2].ulPropTag == PR_IMPORTANCE)
    &leftsign;
     DEBUGMSG(TRUE, (L"Importance: %d \\r\\n", rgprops[2].Value.ul));
    &rightsign;

    // Free the returned SPropValue structure.
    MAPIFreeBuffer(rgprops);       
   &rightsign;

   SPropValue *pspvSubject = NULL;
   SPropValue *pspvEmail   = NULL;
   SizedSPropTagArray(1, sptaSubject) = &leftsign; 1, PR_SUBJECT&rightsign;;
   SizedSPropTagArray(1, sptaEmail)   = &leftsign; 1, PR_RECEIVED_BY_NAME&rightsign;;

   // For SMS, the subject is also the message body
   hr = pMsg->GetProps((SPropTagArray *) &sptaSubject,
    MAPI_UNICODE,
    &cValues,
    &pspvSubject);
   if (FAILED(hr)) &leftsign;
    RETAILMSG(TRUE, (TEXT("Unable to get the message body!\\r\\n")));
    goto Exit;
   &rightsign;

   IMAPITable* pTable = NULL;

   //通过GetRecipientTable获取联系人信息列表

   pMsg->GetRecipientTable( NULL, &pTable );

   LPADRLIST pRecipentRows          = NULL;

   //获取每个联系人信息,这里的做法可以看出和枚举Folder等都相似

   while(!FAILED(hr = pTable->QueryRows(1, 0, (LPSRowSet*)&pRecipentRows)))

   &leftsign;

    if( pRecipentRows->cEntries == 0 )

     break;

    for(int n = 0; n < pRecipentRows->cEntries; n++ )

    &leftsign;

     //每个Entry代表一个联系人信息,每个联系人信息又有多个属性组成

     for(int i = 0; i < pRecipentRows->aEntries[n].cValues ; i++)

     &leftsign;

      //判断如果是PR_EMAIL_ADDRESS属性,那么就找到了联系人地址

      if( PR_EMAIL_ADDRESS == pRecipentRows->aEntries[n].rgPropVals[i].ulPropTag )

      &leftsign;

       //联系人地址

       CString strContact     = pRecipentRows->aEntries[n].rgPropVals[i].Value.lpszW;

       //后续操作

      &rightsign;

     &rightsign;
    &rightsign;

    //完了记得要释放pRecipentRows和它里面的内容,释放方法见上一篇关于设置联系人信息的介绍。

    //……

   &rightsign;

   // get the sender\’s address or phone number
   hr = pMsg->GetProps((SPropTagArray *) &sptaEmail,
    MAPI_UNICODE,
    &cValues,
    &pspvEmail);

   if (FAILED(hr)) &leftsign;
    RETAILMSG(TRUE, (TEXT("Couldn\’t get the sender\’s address!\\r\\n")));
    goto Exit;
   &rightsign;

标签:, , , , ,
20070603 vs2005 smartphone sms 资料 CE MAPI - 二月 5, 2008 by yippee

20070603 vs2005 smartphone sms 资料 CE MAPI
http://www.yippeesoft.com

http://blog.csdn.net/yzx0023/archive/2005/08/11/451643.aspx
原创)CE MAPI实例讲解 — 如何获取Inbox里的所有消息(二)

http://www.outlookexchange.com/articles/KonstantinZheludev/zheludev_am4.asp
How to create MS Exchange profiles in MS Outlook with MAPI

http://www.codeproject.com/listctrl/Address_book_in_MAPI.asp
Large Address book in MAPI

http://www.codeproject.com/csharp/remote_mail.asp
Remote Mail (.NET Remoting + MAPI)

http://www.ioicn.com.cn/bbs/archiver/tid-120896.html
【原创】如何在手机通话中实现声音提示(原代码)

http://caotingna.com/item/ruguo-jiehuo-duanxin__129965.aspx
在PocketPC2003或smartphone2003里,如何去截获一条短信?一定要在系统里的那短信程序收到之前截获

http://forums.microsoft.com/MSDN-CHT/ShowPost.aspx?PostID=390992&SiteID=14
微軟技術社群討論區»Visual Studio»Visual Studio一般討論區(General)»windows address book(WAB) 請問新增連絡人的流程有哪些?    

http://www.stubbs.cn/dev/6305/5222931.htm
无聊客请进,关于接收短信,分少,多包含

http://www.wrconsulting.com/Software/Publications/Exchange/Folders/Client.htm
Writing Simple Exchange Server Client

http://www.codeproject.com/cs/internet/simplemapidotnet.asp?df=100&forumid=3555&exp=0&select=1903020
Simple MAPI.NET

http://www.codeproject.com/ce/SMS_CEMPI.asp
Sending an SMS using CEMAPI

http://bbs.pdafans.com/viewthread.php?tid=246502
如何通过CEMAPI读取并正确显示EMAIL的内容?

http://msdn2.microsoft.com/en-us/library/ms838293.aspx
Introduction to MAPI in Pocket PC 2002 C++ Applications, Part 3

http://www.winbile.net/Detail.aspx?D=260,1113999,771,120
使用CEMAPI发送一封SMS

http://blogs.msdn.com/nazimms/archive/2005/09/08/462495.aspx
Sending and receiving SMS using NETCF

http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=5477acd6-d58d-41d0-9390-ed0daa1f9dda
 GotDotNet User Sample: Sending and receiving SMS messages using NETCF

 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/ReceivingSMSMessages.asp
 Receiving SMS Messages Inside a Managed Application

 http://www.microsoft.com/china/msdn/library/langtool/vsdotnet/ReceivSMSMessages.mspx?mfr=true
 在托管应用程序中接收 SMS 消息

 http://www.microsoft.com/downloads/details.aspx?familyid=98ccf3d4-db7c-4a7d-a323-53bbdbbe0420&displaylang=en
 .NET Compact Framework Sample: Receiving SMS Messages

 http://delphi.ktop.com.tw/board.php?fid=920&tid=24722
 MAPI example code for getting folders and messages

 http://www.wischik.com/lu/Programmer/MapiUtils
 MAPI example code for getting folders and messages

 http://www.cj.idv.tw/show.asp?id=132&totable=1
 bool CMAPIView::msgstore()
&leftsign;
 IMAPISession *pIMapi = NULL;
 if(MAPIInitialize(NULL) != S_OK)
  return false;
 if(MAPILogonEx(0,NULL,NULL,0,&pIMapi) !=S_OK)
 &leftsign;
  MAPIUninitialize();
  return false;
 &rightsign;
 IMAPITable *pIMapiStoresTable = NULL;
 long hr = pIMapi->GetMsgStoresTable(0,&pIMapiStoresTable);
 if (FAILED(hr))
 &leftsign;
  MessageBox(TEXT("GetMsgStoresTable"), TEXT("Installed Transports"), MB_OK);
  pIMapi->Logoff(0,0,0);
  pIMapi->Release();
  pIMapi = NULL;
  MAPIUninitialize();
  return false;
 &rightsign;
 IMsgStore *pPop3Store = NULL;
 SRowSet * pRowSet = NULL;
 SizedSPropTagArray(2,tblColumns) = &leftsign;2,&leftsign;PR_DISPLAY_NAME,PR_ENTRYID&rightsign;&rightsign;;
 pIMapiStoresTable->SetColumns((LPSPropTagArray)&tblColumns,0);
 hr = pIMapiStoresTable->QueryRows(1,0,&pRowSet);
 if (_tcscmp(TEXT("POP3"), pRowSet->aRow[0].lpProps[0].value.lpszW) ==0)
 &leftsign;
  ENTRYID *pEntry = (ENTRYID *) pRowSet->aRow[0].lpProps[1].value.bin.lpb;
  ULONG ulStoreBytes = pRowSet->aRow[0].lpProps[1].value.bin.cb;
  pIMapi ->OpenMsgStore(NULL,ulStoreBytes,pEntry,NULL,NULL,&pPop3Store);
  FreeProws(pRowSet);
 &rightsign;
 FreeProws(pRowSet);
 pIMapiStoresTable->Release();
 if (!pPop3Store)
 &leftsign;
  pIMapi->Logoff(0,0,0);
  pIMapi->Release();
  pIMapi = NULL;
  MAPIUninitialize();
  return false;
 &rightsign;
 //open up the pop3 folder
 LPSPropvalue rgprops = NULL;
 LPSPropvalue lppPropArray = NULL;
 ULONG cvalues = 0;
 IMAPIFolder *pPOPDraftsFolder = NULL;
 SizedSPropTagArray(2,rgTags) = &leftsign;2,&leftsign;PR_CE_IPM_DRAFTS_ENTRYID,PR_OBJECT_TYPE&rightsign;&rightsign;;
 hr = pPop3Store->GetProps((LPSPropTagArray)&rgTags,MAPI_UNICODE, &cvalues, &rgprops);
 hr = pPop3Store->OpenEntry(rgprops[0].value.bin.cb,(LPENTRYID)rgprops[0].value.bin.lpb,NULL,MAPI_MODIFY,NULL,(LPUNKNOWN*)&pPOPDraftsFolder);
 IMessage *pNewMessage = NULL;
 hr = pPOPDraftsFolder->CreateMessage(NULL,0,&pNewMessage);
 SPropvalue sMsgProps[2];
 TCHAR tchSubject[128]= TEXT("\\0");
 memset(&sMsgProps, 0, sizeof(sMsgProps));
 wsprintf(tchSubject, TEXT("Test Message Subject"));
 sMsgProps[0].ulPropTag = PR_MESSAGE_FLAGS;
 sMsgProps[0].value.ul = MSGFLAG_UNSENT;
 sMsgProps[1].ulPropTag = PR_SUBJECT;
 sMsgProps[1].value.lpszW = tchSubject;
 hr = pNewMessage->SetProps(2,sMsgProps,NULL);
 if (FAILED(hr))
 &leftsign;
  pNewMessage->Release();
  return false;
 &rightsign;
 IStream *pStream = NULL;
 TCHAR tchBody[255] = TEXT("\\0");
 wsprintf(tchBody,TEXT("This is a test of the message body"));
 hr = pNewMessage->OpenProperty(PR_BODY, NULL , 0, MAPI_CREATE&line;MAPI_MODIFY,(IUnknown **)&pStream);
 if (FAILED(hr))
 &leftsign;
  pNewMessage->Release();
  return false;
 &rightsign;
 DWORD dwLength = (lstrlen(tchBody)+1)*sizeof(TCHAR);
 pStream->Write(tchBody,dwLength, NULL);
 pStream->Release();
 SizedADRLIST(1, msgAdrList);
 SPropvalue rgMsgProps[3];
 memset(&rgMsgProps, 0, sizeof(rgMsgProps));
 rgMsgProps[0].ulPropTag = PR_ADDRTYPE;
 rgMsgProps[0].value.lpszW = TEXT("SMTP");
 rgMsgProps[1].ulPropTag = PR_EMAIL_ADDRESS;
 rgMsgProps[1].value.lpszW = TEXT("someone@somewhere");
 rgMsgProps[2].ulPropTag = PR_RECIPIENT_TYPE;
 rgMsgProps[2].value.ul = MAPI_TO;
 msgAdrList.cEntries = 1;
 msgAdrList.aEntries->cvalues = 3;
 msgAdrList.aEntries->rgPropVals = rgMsgProps;
 hr = pNewMessage->ModifyRecipients(MODRECIP_ADD,(LPADRLIST)&msgAdrList);
 MAPIFreeBuffer((LPADRLIST)&msgAdrList);
 hr = pNewMessage->SubmitMessage(0);
 if (FAILED(hr))
  MessageBox(TEXT("SubmitMessage Failed"), TEXT("Installed Transports"), MB_OK);
 pNewMessage->Release();
pPOPDraftsFolder->Release();
 pPop3Store->Release();
 return true;
&rightsign;

我也已经能够打开Inbox了,还能计算出里面SMS的数量,但还是无法找到SMS的信息….不知道为什么总是返回""(空字符串)!

代码如下:
HRESULT hr;
ICEMAPISession * pSession = NULL;
IMAPITable * pTable = NULL;
SRowSet * pSRowSet = NULL;
IMsgStore * pStore = NULL;
if (MAPILogonEx(0,NULL,NULL,0,(LPMAPISESSION *)&pSession) != S_OK)
&leftsign;
MessageBox(hwnd,_T("Failed to logon"),_T("Error"),0);
&rightsign;else
&leftsign;
//SizedSPropTagArray(2, PropTagArr) = &leftsign;2,&leftsign;PR_DISPLAY_NAME,PR_ENTRYID&rightsign;&rightsign;;
SizedSPropTagArray(1, PropTagArr) = &leftsign;1,&leftsign;PR_CE_IPM_INBOX_ENTRYID&rightsign;;
hr = pSession->GetMsgStoresTable(MAPI_UNICODE,&pTable);
hr = pTable->SetColumns((LPSPropTagArray)&PropTagArr, 0);
if (!hr)
&leftsign;
do
&leftsign;
hr = pTable->QueryRows(1,0,&pSRowSet);
LPSPropValue lpProp;
lpProp = &pSRowSet->aRow[0].lpProps[0];

if(_tcscmp( lpProp->Value.LPSZ, _T("SMS") ) == 0 )
&leftsign; break;

&rightsign;
FreeProws(pRows);
pSRowSet = NULL;
&rightsign;while (!hr);

hr = pTable->QueryRows(1,0,&pSRowSet);
hr = pSession->OpenMsgStore (NULL,
pSRowSet->aRow[0].lpProps[0].Value.bin.cb,
(ENTRYID *) pSRowSet->aRow[0].lpProps[0].Value.
bin.lpb, NULL, 0, &pStore);

IMessage * lpMessage;
ULONG pcount =0;
SPropValue *rgprops = NULL;

hr = pStore->OpenEntry(pSRowSet->aRow[0].lpProps[0].Value.bin.cb, (LPENTRYID)pSRowSet->aRow[0].lpProps[0].Value.bin.lpb, NULL, 0, NULL, (LPUNKNOWN FAR *)&lpMessage);
SizedSPropTagArray(1,rgTags) = &leftsign;1,PR_SUBJECT&rightsign;;
hr = lpMessage->GetProps((LPSPropTagArray)&rgTags, MAPI_UNICODE, &pcount, &rgprops);
// s = rgprops->Value.lpszW;

pTable->Release();
&rightsign;
&rightsign;

为什么我在 pMsgStore->OpenEntry(rgprops[0].Value.bin.cb, (LPENTRYID)rgprops[0].Value.bin.lpb, NULL, MAPI_MODIFY, NULL, (LPUNKNOWN*)pFolder );
的时候,得到HRESULT是E_INVALIDARG?

标签:, , , , , ,
20070504 sqlite smartphone 2003 vs2005 - 一月 18, 2008 by yippee

20070504 sqlite smartphone 2003 vs2005
http://www.yippeesoft.com

基本实现SQLITE的访问
TCHAR szFile[MAX_PATH];
       TCHAR szPath[MAX_PATH];
       GetModuleFileName(NULL,szFile,MAX_PATH);
       size_t i;
       for(i=lstrlen(szFile)-1; i>0 && szFile[i]!=\’\\\\\’; i–);
           szFile[i]=\’\\0\’;

感觉这样分割路径,不是很好,这是ANSI的做法,UNICODE看上去可以,不过不知道有没有后遗症
最好用 http://www.yippeesoft.com

Break a path name into components. These functions are deprecated because
more secure versions are available, see _splitpath_s,
_wsplitpath_s
.

       lstrcpy(szPath,szFile);
       lstrcat(szPath,_T("\\\\YippeeMoneySp.db"));
       m_info=szPath;
       m_info+="\\r\\n";

       CppSQLite3DB db;
       db.open(szPath);
       CppSQLite3Query q = db.execQuery(_T("select * from test;"));
       for (int fld = 0; fld < q.numFields(); fld++)
       &leftsign;
           m_info+= q.fieldName(fld);
           m_info+="(" ;
           m_info+=+ q.fieldDeclType(fld);
           m_info+=+ ")&line;";
       &rightsign;
       m_info+= "\\r\\n";

       while (!q.eof())
       &leftsign;
           m_info+= q.fieldValue(0) ;
           m_info+= "&line;\\r\\n";
           
           q.nextRow();
       &rightsign;
       UpdateData(FALSE);
   
采用
http://softvoile.com/development/CppSQLite3U/

有个小问题
int CppSQLite3DB::execScalar(LPCTSTR szSQL)
&leftsign;
   CppSQLite3Query q = execQuery(szSQL);

   if (q.eof() &line;&line; q.numFields() < 1)
       throw CppSQLite3Exception(CPPSQLITE_ERROR, _T("Invalid scalar query"),    DONT_DELETE_MSG);

   return _tstoi(q.fieldValue(0));
&rightsign;

报告:
.\\CppSQLite3U.cpp(293) : error C2664: \’atoi\’ : cannot convert parameter 1 from \’LPCTSTR\’ to \’const char *\’
       Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

Return Value
Each function returns the int value produced by interpreting the input characters as a number. The return value is 0 for atoi and _wtoi, if the input cannot be converted to a value of that type.

In Visual C++ 2005, in the case of overflow with large negative integral values, LONG_MIN is returned. atoi and _wtoi return INT_MAX and INT_MIN on these conditions. In all out-of-range cases, errno is set to ERANGE. If the parameter passed in is NULL, the invalid parameter handler is invoked, as described in Parameter Validation. If execution is allowed to continue, these functions set errno to EINVAL and return 0.

Remarks
These functions convert a character string to an integer value (atoi and _wtoi). The input string is a sequence of characters that can be interpreted as a numerical value of the specified type. The function stops reading the input string at the first character that it cannot recognize as part of a number. This character may be the null character (\’\\0\’ or L\’\\0\’) terminating the string.

The str argument to atoi and _wtoi has the following form:

[whitespace] [sign] [digits]]

A whitespace consists of space or tab characters, which are ignored; sign is either plus (+) or minus (–); and digits are one or more digits.

The versions of these functions with the _l suffix are identical except that they use the locale parameter passed in instead of the current locale.

TCHAR.H routine  _UNICODE & _MBCS not defined  _MBCS defined  _UNICODE defined  
_tstoi
atoi
atoi
_wtoi

_ttoi
atoi
atoi
_wtoi

干脆改为 _WTOI OK

http://www.sqlite.org/cvstrac/wiki?p=SqliteWrappers

标签:, , , , ,
20070503 vc.net vs2005 smartphone 2003 - 一月 14, 2008 by yippee

20070503 vc.net vs2005 smartphone 2003
http://www.yippeesoft.com

以前都习惯递增,昨天发现居然忘了自己什么时候弄的了,想想算了,还是写实际日期吧

SQLITE编译PASS,可是很多函数方法都要考虑UNICODE了,有些麻烦

资料:
http://www.codeproject.com/ce/SQLite3Wrapper.asp
Introduction

Here is another wrapper for the famous SQLite3 database engine. While there are several other wrappers available here at Code Project, I don\’t believe they support MFC/Unicode or have the results tested on a Pocket PC.

The wrapper source code is based on the SQLiteWrapper source produced by rene.nyffenegger@adp-gmbh.ch. I altered the original source while packaging it for use with Microsoft MFC. My primary objective in this exercise was to make the wrapper suitable for both MCBS and Unicode because Unicode is native to the Pocket PC. There are four key differences between this wrapper and the author\’s original source.

    * First, all the instances of std::string were converted to Microsoft\’s generic string pointers using LPCTSTR. This should be familiar to developer\’s accustomed to working with MFC. This also means that you should rely heavily on the Microsoft TEXT or _T macros for hard-coded character strings should you wish to maintain portability between the desktop and the Pocket PC.
    * Second, I have changed the class SQLiteStatement to CSqlStatement and SQLiteWrapper to CDbSQLite. This was primarily a matter of preference since most MFC developer\’s recognize Microsoft\’s conventions for the "Cx" nomenclature.
    * Third, I removed exception handling from the wrapper. Windows CE does not support the traditional try, catch and throw paradigm so you are basically on your own with respect to error handling.
    * Finally, I have added the header SQLite3i.h with typedefs to the various sqlite3.h functions. These type definitions are "internal" accessors to the sqlite3 functions conditionally utilizing either the UTF-8 or UTF-16 variation during compilation. For your entertainment, I incorporated a pragma in the header to inform you when you are compiling Unicode or MCBS.

Care and feeding

The test programs provided here are simple MFC dialog applications incorporating two buttons, an edit box and a list control. The "Create" button is used to populate the database with three entries. The "review" button is used to populate the list control with the database records. It is acceptable to click the "Create" button more than once. You may even wish to do so to observe any errors reported. The edit box is used simply for status info.

This code was tested on a Windows desktop and on a Pocket PC. As part of my test, I moved the database created by the Pocket PC to my desktop and then reviewed it using the desktop application.

CppSQLite3U is a C++ unicode wrapper around the SQLite database

Some of my utilities use embeded database for storing their data. I have chose SQLite as database engine, it\’s very easy and fast. SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine. For more information visit SQLite homepage.

Initially, I used very handy CppSQLite3 wrapper from Rob Groves. But, some time ago I had to rewrite Flashpaste for unicode support. Unfortunately, CppSQLite3 can\’t work in UNICODE configuration. I could not find other good wrapper with unicode support, so I decided that I should write my own wrapper for myself. I took the CppSQLite3 as a solid base for it and created CppSQLite3U class.
What did I make?

I have implemented the following clases in the unicode version : CppSQLite3Exception, CppSQLite3DB, CppSQLite3Statement, CppSQLite3Query. Additionally, I have fixed some small bugs and modernized some piece of code (procedure execQuery, execScalarStr, open etc.)
http://softvoile.com/development/CppSQLite3U/

http://www.codeproject.com/database/CppSQLite.asp
CppSQLite – C++ Wrapper for SQLite
Introduction

This article describes CppSQLite, a very thin C++ wrapper around the public domain SQLite database library.

A description of how to link applications with SQLite is provided, then an example program using CppSQLite is presented, and finally the CppSQLite classes are documented.

To set the scene, here is a quote from the SQLite author…

    SQLite is a C library that implements an embeddable SQL database engine. Programs that link with the SQLite library can have SQL database access without running a separate RDBMS process. The distribution comes with a standalone command-line access program (SQLite) that can be used to administer a SQLite database and which serves as an example of how to use the SQLite library.

    SQLite is not a client library used to connect to a big database server. SQLite is the server. The SQLite library reads and writes directly to and from the database files on disk.

Background

I am always on the lookout for simple yet powerful software development tools and ideas, and SQLite definitely falls into this category. In fact, the "Lite" name is a bit misleading, as it implements a large subset of the SQL standard, including transactions, and when projects such as PHP start to bundle it as standard instead of MySQL, you have to take a look.

I thought it would be fun to write a thin wrapper around the C interface to make it C++ friendly. There are already a number of C++ wrappers listed on the SQLite website, but one is commercial, another seemed a bit complex, and another is specific to the wxWidgets framework. After all, the author of SQLite looks to have gone to pains to keep things simple, so I thought a C++ wrapper for it should keep things simple as well.
Working With SQLite

SQLite is provided in 2 packages on the Windows platform, as a compiled DLL, and also in source form. Even if you only wish to use the DLL, you will still need to get the source code, as this contains the required header file.

If desired, the SQLite source could be compiled into a library (.lib) file for statically linking with your application, but this is not covered in this article. Compilation instructions can be found on the SQLite web site.

Linking dynamically still requires that a .lib file is built for linking with your application. This can be done using Microsoft\’s LIB command. On my system, this is located at D:\\Program Files\\Microsoft Visual Studio\\VC98\\Bin\\lib.exe.

Unzip sqlite.zip which contains sqlite.dll and sqlite.def, and execute the following command to produce the lib file.

The error message is :

.\\ServiceInterface.cpp(225) : error C2668: \’ATL::CStringT<BaseType,StringTraits>::CStringT\’ : ambiguous call to overloaded function

with

[

BaseType=char,

StringTraits=StrTraitMFC_DLL<char>

]

D:\\Program Files\\Microsoft Visual Studio 8\\VC\\atlmfc\\include\\cstringt.h(1174): could be \’ATL::CStringT<BaseType,StringTraits>::CStringT(wchar_t,int)\’

with

[

BaseType=char,

StringTraits=StrTraitMFC_DLL<char>

]

Thanx a lot …. !!

I tried the following :

returnee += CString((TCHAR)c3, 1);

and it worked.

标签:, , , , , ,
20070811 vs2005 vs2003 smartphone 模拟器 activesync - 一月 12, 2008 by yippee

20070811 vs2005 vs2003 smartphone 模拟器 activesync
http://www.yippeesoft.com

安装 VS2003 VS2005 ACTIVESYNC4.5 ,使用VS2005的模拟器用ACTIVESYNC连接,然后VS2003直接部署到设备调试

下载:
Device Emulator 2.0 Preview
http://www.microsoft.com/downloads/details.aspx?FamilyId=13F5DE85-30CD-4506-9C5B-A2068FA1EE9E&displaylang=en

运行register.bat
这样ACTIVESYNC会增加一个DMA连接

运行VS2005的设备仿真器管理器,CONNECT模拟器,cradle,这时候ACTIVESYNC将检测到设备连接

VS2003开始调试运行即可

当然,前提是内存够大,不然我也不敢这么运行了

资料:
Microsoft Device Emulator 2.0 Beta – Community Technology Preview
Brief Description
This is an updated release of the Device Emulator for ARM CPUs that first released with Visual Studio 2005.
This is the Beta version of Microsoft Device Emulator 2.0. The RTM version of this emulator will be released with the upcoming Windows CE 6.0 release. This Emulator has the same executables and DLLs as the 1.0 emulator that came with Visual Studio 2005 RTM and has upgraded performance and some new features. This install does not replace the emulator installed with Visual Studio 2005. The installer that comes with this preview only copies the relevant binaries to the user\’s system.

VS无法调试智能设备程序的解决方案
Posted on 2005-09-14 13:59 清雷 阅读(156) 评论(0)  编辑 收藏 引用 网摘 所属分类: Mobile Development
     近来在做Windows CE.NET应用程序开发时,虽然可以通过Microsoft ActiveSync连接到智能设备,但是,通过VS调试智能设备程序时,老是报:没有建立可靠的物理连接,必须手动拷贝到智能设备机器上,通过 MessageBox.show()来调试,问题出在哪呢?查阅一下MSDN,总结一下经验,可以通过以下这几个方案来解决:
    1.将%Microsoft Visual Studio .NET 2003%\\CompactFrameworkSDK\\WinCE Utilities\\ToolHelp\\WinCE4相应CPU文件夹下的toolhelp.dll拷贝到智能设备的Windows目录下,重新启动智能设备;
    2.执行%Microsoft Visual Studio .NET 2003%\\CompactFrameworkSDK\\WinCE Utilities\\WinCE Proxy Ports Reg下的ProxyPorts.reg和WinCEx86Device.reg添加进注册表;
    3.执行%Microsoft Visual Studio .NET 2003%\\CompactFrameworkSDK\\WinCE Utilities\\DelDesktopCryptKey下的DelDesktopCryptKey.exe程序;
    4.在VS中,选择"工具"-"Select Windows CE Device CPU",在"Select Windows CE CPU"对话框中选中相应智能设备的CPU类型,然后"确定"后重新启动VS.
   上述几个解决办法并不要每个都执行,如果这四个方法都不行的法,那就只能重新安装Microsoft ActiveSync拉!

一个空程序也是不行,在Visual studio 2005上调试smartphone2003还是不行,查了一下资料,有人提出如下解决方法:
(1)原来是由于security key container过期了,安装Windows CE Utilities for Visual Studio .NET 2003 Add-on package 后,在命令行中到Program Files\\Microsoft Visual Studio .NET 2003\\CompactFrameworkSDK\\WinCE Utilities\\DelDesktopCryptKey目录下运行DelDesktopCryptKey.exe,然后在重启一下计算机,问题解决。
(2)导入Program Files\\Microsoft Visual Studio .NET 2003\\CompactFrameworkSDK\\WinCE Utilities\\WinCE Proxy Ports Reg下的注册表项。

但我的实际情况是,上述两种方法还是不行,难道是Windows Mobile 5.0的手机不能调试smartphone 2003的程序???请各位解答一下

感觉很奇怪,我明明用activesync是可以连上的。到msdn上搜了一下(http://support.microsoft.com/default.aspx?scid=kb;en-us;816826
原文如下:
certain users on the desktop computer may notice that the deployment to a pocket pc device that is connected with activesync is not successful and you receive the following error message:
could not establish a connection with the device. please make sure the device is connected and working properly.
other users on the same computer may be able to deploy and to debug by using the same device, may find that activesync is working correctly, and may find that the file \\windows\\conmanclient.exe is not copied to the device when they try to deploy or to debug. these symptoms indicate a possible corrupted security key container.

on the computer that is running visual studio .net, run the deldesktopcryptkey.exe utility from the command prompt to clean the security key container for the current user. deldesktopcryptkey.exe is installed with the windows ce utilities for visual studio .net 2003 add-on pack. by default, deldesktopcryptkey.exe is located in the program files\\microsoft visual studio .net 2003\\compactframeworksdk\\wince utilities\\deldesktopcryptkey folder.

原来是由于security key container过期了,安装windows ce utilities for visual studio .net 2003 add-on package 后,在命令行中到program files\\microsoft visual studio .net 2003\\compactframeworksdk\\wince utilities\\deldesktopcryptkey目录下运行deldesktopcryptkey.exe,然后在重启一下计算机,问题解决。

A.安装开发工具

安装准备:先安装Mobile Application Development Toolkit,并仔细阅读其中的内容

1.Microsoft ActiveSync 4.1 – Worldwide English

2.Visual Studio.NET 2003

3.SDK for Windows Mobile 2003-based Smartphones

4.Emulator Images for Windows Mobile 2003 Second Edition-based Smartphone

5. Chinese Simplified Emulation Images.msi

6.Windows CE .NET Utilities v1.1 for Visual Studio .NET 2003

7.Windows Mobile Developer Power Toys

其他工具

Windows Mobile 5.0 SDK for Smartphone

Developer Resources for Windows Mobile 2003 Second Edition

eMbedded Visual C++ 4.0

Note: Use the following CD key when installing this software: TRT7H-KD36T-FRH8D-6QH8P-VFJHQ
eMbedded Visual C++ 4.0 SP4

B.部署失败的解决办法

 用.net 2003开发SmartPhone时,在部署的时候会出现如下的错误:

错误: 无法建立连接。请确保此设备已经与开发计算机建立了物理连接。
———————- 完成 ———————

    生成: 1 已成功, 0 已失败, 0 已跳过
    部署: 0 已成功, 1 已失败, 0 已跳过

解决办法:安装Windows CE .NET Utilities v1.1 for Visual Studio .NET 2003后,到Program Files\\Microsoft Visual Studio .NET 2003\\CompactFrameworkSDK\\WinCE Utilities\\DelDesktopCryptKey目录下运行DelDesktopCryptKey.exe,清除当前用户的security key,问题可以解决。

VS.NET Compact Framework Deployment Issues

I have a problem with deploying .NET CF Framework applications from Visual Studio .NET.  I seek your advice…

I try to deploy to a device and get this error in VS.NET 2003:

"Cannot establish a connection. Be sure the device is physically connected to the development computer."

Apparently, what I did was upgrade to Activesync 3.7.1 AFTER having installed Visual Studio .NET 2003.  Now, according to various sources (see Troubleshooting in this link), you need to uninstall and reinstall Visual Studio .NET (or at least uninstall Smart Device support and reinstall it).  I have done both, and as of yet, to no avail.

I have also copied the ProxyPorts section from a machine that does work.

Before I format my machine, anyone have any thoughts on what I might need to do to get this working?  I really do not want to waste the time reinstalling everything.

UPDATE: Fixed it! After a few more installs/uninstalls, I found this link to the Windows CE Utilities Add-on pack 1.1, and running DelDesktopCryptoKey.exe fixed me all up…

症状
当您删除并重新安装 ActiveSync 3.5, 无法部署智能设备应用程序向设备是通过 USB 连接具有安装, Visual Studio NET 2003 计算机上。 您可能收到以下错误消息:
部署到 Pocket PC 设备使用 TCP 连接传输错误: 无法建立连接。 确保设备是物理连接到开发计算机。

回到顶端
原因
当您安装 VisualStudio.NET, 安装将用于 ActiveSync 与代理端口相关的注册表项。 这些代理端口注册表项通知 ActiveSync 将转发所有 localhost、 代理端口特定 TCP 数据到设备。 当您删除或重新安装 ActiveSync, 这些注册表项损坏。

回到顶端
解决方案
警告 如果正确修改注册表通过注册表编辑器或通过其他方法可能发生 Serious 问题。 这些问题可能需要重新安装操作系统。 Microsoft 不能保证能够解决这些问题而。 修改注册表需要您自担风险。

要解决此问题, 必须恢复代理端口注册表项。 要恢复这些注册表项, 使用下列方法之一:
• 重新安装 VisualStudio.NET。 要这样做, 请按照下列步骤操作:
1. 删除并重新安装 Visual Studio NET 2003。
2. 重新启动计算机。
有关如何删除以及如何安装 VisualStudio.NET, 请单击下列文章编号以查看 Microsoft 知识库中相应:
312779 (http://support.microsoft.com/kb/312779/) 可视 Studio NET 2002 自述 1 (部分)
• 导出, 然后导入代理端口注册表项。 要这样做, 请按照下列步骤操作:
1. 没有问题, 计算机上找到以下注册表子项:
\\\\HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows CE Services\\ProxyPorts
2. 右击 ProxyPorts , 然后单击 导出 。
3. 作为 Proxyport.reg 保存注册表文件。
4. 将 Proxyport.reg 文件复制到计算机有问题。
5. 双击 Proxyport.reg , 然后单击 是 注册表编辑器 对话框中。 这将代理端口注册表项写入注册表。
6. 重新启动计算机。

http://download.microsoft.com/download/c/d/b/cdbff573-73fb-4f9f-a464-c5adc890e1ae/Readme.htm

 开发基于.NET Compact Framework的程序时, 常遇到的问题(2) – 为什么在Visual Studio 2003调试程序时不能通过ActiveSync连接PDA
这个问题困扰了我好久了, 以前也遇到过这个问题, 找了很多网上的资料, 无非就是重装Visual Studio 2003, 这也太……, 哎, 不说了, 真不知道微软搞的这个什么玩意儿, 要知道重装个Visual Studio 2003, 没有个3小时是搞不定的. 经过多少次痛苦的摸爬滚打, 总算是有点收获了. 现总结如下:
1. 连不上先看看ActiveSync是否正常工作(有时候微软的东西就是很奇怪, 明明USB接口接的好好的, 就是没连上)
2. 如果ActiveSync是连上了, 看看是否能在资源管理器里查看PDA上的内容.
3. 使用IDE里的工具菜单里的连接设备, 在出现的窗口中选择你的设备(Pocket PC), 双击或点连接, 等上一会儿, 如果连接不上的话, 与此同时, 一个无情的对话框告诉你: Deploying to Pocket PC Device using TCP Connect Transport Error: Cannot establish a connection. Be sure the device is physically connected to the development computer. (对不起, 我的是英文版的, 众兄将就一下吧). 那恭喜你了, 你的恶梦开始了. 传说中的问题出现了……

你现在只有几个办法可以解决它(我从最痛苦的说起, 让你有种先苦后甜的感觉也不错的).
1. 据微软官方网站说, 你需要重装Visual Studio 2003 (很对不起, 请允许我说一声,拷, 据然是个BUG! 这谁能受得了呀.)
    http://support.microsoft.com/?kbid=813579, 不过……下面的仁兄也挺悖的(据然reinstall/uninstall多次后才有结果, 不过有结果也算是好的了, 没惨到重装操作系统应该好不少了).   http://weblogs.asp.net/dreilly/archive/2003/12/19/VSNetCFDeployment.aspx
2. 重装ActiveSync, 这个应该是最好的办法了, 也是我今天把问题解决的方法. 其实很简单, 不过我也不知道为什么? 呵呵, 就是把ActiveSync Uninstall后再reinstall, 同时保证装在与上次不同的盘上(或许不同的路径也可以吧, 如果你有时间可以试一下). 结果重启后果然行了. 可以连接到PDA, 同样也可以Deploy到PDA上.

希望对各位仁兄会有所帮助. 最好一次成功.

用于 Visual Studio .NET 2003 的 Windows CE 实用工具附加软件包提供了一些工具,利用这些工具可将 Visual Studio 连接到运行 Windows CE 4.1 及更高版本的设备。利用该附加软件包可以通过 ActiveSync 进行连接,或者可通过以太网(不需要 ActiveSync)直接进行连接。

该下载文件中包含以下实用工具:

    * Windows CE CPU Picker(Windows CE CPU 选择器),用于具有 ActiveSync 的设备
    * Smart Device Authentication Utility(智能设备身份验证实用工具),用于没有 ActiveSync 的设备
    * 在基于 x86 的 Windows CE 设备上启用调试的设置
    * 在某些设备上启用调试所需的组件
    * 解决与 Pocket PC 和非 Pocket PC 设备连接时所发生的已知问题的工具。
    * 解决 SDK emulators 的 XML skin 文件未打开这个已知问题的工具。
    http://www.microsoft.com/downloads/details.aspx?displaylang=zh-cn&FamilyID=7ec99ca6-2095-4086-b0cc-7c6c39b28762

   
I have a VS 2003 ppc project, but when attempting to debug it will not connect to a ppc instance running through device emulator 2.0 preview which is successfully connected through activesync 4.2.

VS 2003 reports;

Deploying to Pocket PC Device using TCP Connect Transport

Error: Cannot establish a connection. Be sure the device is physically connected to the development computer.

I am running norton anti virus 2006 but have switched off the firewall.  The windows XP firewall is disabled.

Does anyone have any ideas why its not connecting?

I solved the problem the following way, after reading lots of posts and pages:

1.- Downloaded the Windows CE Utilities for Visual Studio .NET 2003 Add-on Pack 1.1 from http://www.microsoft.com/downloads/details.aspx?FamilyId=7EC99CA6-2095-4086-B0CC-7C6C39B28762&displaylang=en   you might want to change the language.

2.- Went to the folder where these utilities are installed something like <put path here>\\Microsoft Visual Studio .NET 2003\\CompactFrameworkSDK\\WinCE Utilities

3.- And selected the utility Select WinCE CPU, what I found is that it wasn\’t configured, so I chose in this case an ARMV for an IPAQ rx3715, pressed configure and re-launched VS2003

4.- Connected the PDA and pressed the "connect to device" option, voila…its connected.

Finally I applied the upgrade to ActiveSync 4.2 and it\’s still working.

Hope this helps someone out there,

Regards,

Arvychile

标签:, , , , , , , ,

20070810 smartphone sqlite - 一月 11, 2008 by yippee

20070810 smartphone sqlite
http://www.yippeesoft.com

同事作终端,用了SQLITE,可是数据库操作有点慢
我问了一下,结果同事说底层软件不能和PC比什么的
我觉得作为一个嵌入式数据库,也不可能太慢

找了找资料
硬件配置上,MPX220采用了ARM4 OMAP1611的204MHz CPU

sqlite支持大部分sql92标准,创建表时注意下面几点:
先给个普遍使用的sql语句:CREATE TABLE "user" ("uid" integer PRIMARY KEY , "name" varchar (50) NOT NULL , "password" varchar (32) NOT NULL)
这里注意几点:
“INTEGER PRIMARY KEY”,表示自动增长的id,插入行时留空就能自动增长,如:INSERT INTO "user" ("uid", "name", "password") VALUES (NULL, \’name\’, \’pssword\’),或者INSERT INTO "user" ("name", "password") VALUES (\’name\’, \’pssword\’),另外sqlite允许插入被删除的id,如:DELETE FROM "user" WHERE "uid" = 0; INSERT INTO "user" ("uid", "name", "password") VALUES (1, \’name\’, \’pssword\’),

在插入数据和查询时都会经常遇到单引号(\’)的问题,轻则查询出错,重则导致sql注入,sqlite插入\’和mssql一样,使用\’\'来插入,同样不能插入(\\0),使用时比较简单的方法就是使用php自带的函数(sqlite_escape_string)来格式化,可以参考后面我给的类,注意sqlite_escape_string格式化时比较特别,不是只是简单的把\’转为\’\',具体可以查看php的帮助文档。

有没有注意到"user"呢,这里用双引号(")包括起来,在我们平时比较常见的mssql里是用[]来标记,mysql是用“来标记,不过sqlite比较。。。不知道怎么形容,看例子:
CREATE TABLE \’user\’ (\’uid\’ integer PRIMARY KEY , \’name\’ varchar (50) NOT NULL , \’password\’ varchar (50) NOT NULL)
CREATE TABLE "user" ("uid" integer PRIMARY KEY , "name" varchar (50) NOT NULL , "password" varchar (32) NOT NULL)
CREATE TABLE [user] ([uid] integer PRIMARY KEY , [name] varchar (50) NOT NULL , [password] varchar (32) NOT NULL)
上面3条语法都是可以的。
这里注意下,在mssql环境中我们有时候是使用CREATE TABLE [user] ([uid] [int] PRIMARY KEY , [name] [varchar] (50) NOT NULL , [password] [varchar] (32) NOT NULL),就是字段类型中我们可以使用[]来包括起来,而在sqlite下是不行的。另外还有地方:CREATE INDEX user_name ON "user" ("name"),发现没有,索引中的名字没有用"包括起来,不知道怎么搞的。。如果用了"或\’或[]就不能正常索引了貌似。

这是PC上的
try
&leftsign;
     //Connection string
     string connString = String.Format("Data Source=&leftsign;0&rightsign;;New=False;Version=3", DB_NAME);
     
     //Connecting database
     SQLiteConnection sqlconn = new SQLiteConnection(connString);
     
     //Open the connection
     sqlconn.Open();

     //Query
     string CommandText = "Select name from sqlite_master;";

     //SQLiteDataAdapter to fill the DataSet
     SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(CommandText, sqlconn);
     dataAdapter.Fill(ds);

     //Get the collection of rows from the DataSet
     DataRowCollection dataRowCol = ds.Tables[0].Rows;

     //Add the tables available in the DB to the combo box
     foreach (DataRow dr in dataRowCol)
     &leftsign;
         tablecombobox.Items.Add(dr["name"]);
     &rightsign;
     
     //Close the Connection
     sqlconn.Close();

&rightsign;              
catch (SQLiteException sqlex)
&leftsign;
   MessageBox.Show(sqlex.Message);
&rightsign;

手机:
SQLiteConnection conn = new SQLiteConnection();
           conn.ConnectionString = "Data Source=\\\\Storage\\\\Program Files\\\\t2\\\\test1.db;Version=3;New=False;Compress=True;";
           conn.Open();
           if (conn.State != ConnectionState.Open)
               return;
           SQLiteCommand cmd = conn.CreateCommand();
           cmd.CommandText = "select sff from sf where ss=\’"+textBox2.Text+"\’";
           IDataReader r= cmd.ExecuteReader();

           if (r.Read())
           &leftsign;
               textBox1.Text=r.GetString(0);
           &rightsign;

用VS2005的设备仿真器倒是和ACTIVESYNC连接了,可是该死的VS2003却没有办法进行TCP连接

例如
string time=DateTime.Now.ToString("yyyyMMddHHmmss");
DateTime dt=Convert.ToDateTime(time);
后面那句怎么改,才会成功转换回来?
DateTime dt = DateTime.ParseExact(time,"yyyyMMddHHmmss",System.Globalization.CultureInfo.CurrentCulture);

例如  
 —–表———  
 id     name     age   sex  
 1       tom       18     male  
 —————-  
 如何实现如果表中存在   name   =“tom”则更新   age   =   20  
 如果没有的话,则插入一条新的记录。
 string   sql   =   @"  
 IF   EXISTS   (SELECT   *   FROM   表   WHERE   [name]=\’tom\’)  
     UPDATE   …  
 ELSE  
     INSERT   …  
 END  
 ";  

 SqlCommand   cmd   =   new   SqlCommand("select   count(*)   from   theTable   where   [name]=\’tom\’",   cn);  
 int   c   =   int.Parse(cmd.ExecuteScalar().ToString());  
 
 if   (c   >0)  
 &leftsign;  
 //更新  
 &rightsign;  
 else  
 &leftsign;  
 //插入  
 &rightsign;

 string   sql   =   @"  
 IF   EXISTS   (SELECT   *   FROM   [表]   WHERE   [name]=\’tom\’)  
     UPDATE   [表]   SET   [age]=20   WHERE   [name]=\’tom\’  
 ELSE  
     INSERT   INTO   [表]   ([name],[age],[sex])   VALUES   (\’tom\’,20,\’male\’)  
 END  
 ";  
 
 一条SQL语句就足够了,   用不着象楼上的那么麻烦.  

 string   sql   =   @"  
 IF   EXISTS   (SELECT   *   FROM   [表]   WHERE   [name]=\’tom\’)  
     UPDATE   [表]   SET   [age]=20   WHERE   [name]=\’tom\’  
 ELSE  
     INSERT   INTO   [表]   ([name],[age],[sex])   VALUES   (\’tom\’,20,\’male\’)  
 END  
 ";  
 
 或者可以写在存储过程里

 还不如简单一点  
 直接先做一个Delete,然后Insert  
 
 如果存在,删除后新增,逻辑上没有问题,结果也是正确的  
 如果不存在,删除语句不作任何影响,再添加,效果相同  
 
 反正2次数据库操作是必然的了  
 那又何必多做一次无意义的If运算呢
 文件操作

若要执行此操作… 请参阅本主题中的示例…
创建文本文件 向文件写入文本  
写入文本文件 向文件写入文本  
读取文本文件 从文件读取文本  
向文件中追加文本 File.AppendText FileInfo.AppendText  
重命名或移动文件 File.Move FileInfo.MoveTo  
删除文件 File.Delete FileInfo.Delete  
复制文件 File.Copy FileInfo.CopyTo  
获取文件大小 FileInfo.Length  
获取文件属性 File.GetAttributes  
设置文件属性 File.SetAttributes  
确定文件是否存在 File.Exists  
读取二进制文件 对刚创建的数据文件进行读取和写入  
写入二进制文件 对刚创建的数据文件进行读取和写入  
检索文件扩展名 Path.GetExtension  
检索文件的完全限定路径 Path.GetFullPath  
检索路径中的文件名和扩展名 Path.GetFileName  
更改文件扩展名 Path.ChangeExtension  

目录操作

System.IO 类

目录操作
string[] drives = Directory.GetLogicalDrives(); //本地驱动器的名,如:C:\\等
string path = Directory.GetCurrentDirectory();    //获取应用程序的当前工作目录
Path.GetFileName(@"c:\\dir\\file.txt");             //获取子目录的名字,result的结果是file.txt
Directory.GetFiles(路径及文件名)                  //获取指定目录中的文件名(文件列表)
DirectoryInfo di = new DirectoryInfo(@"f:\\MyDir"); //构造函数创建目录
DirectoryInfo di=Directory.CreateDirectory(@"f:\\bbs"); //创建对象并创建目录
if (di.Exists == false) //检查是否存在此目录
di.Create(); //创建目录
DirectoryInfo dis = di.CreateSubdirectory("SubDir"); //以相对路径创建子目录
dis.Delete(true); //删除刚创建的子目录
di.Delete(true); //删除创建目录

文件操作
Directory.Delete(@"f:\\bbs2", true); //删除目录及其子目录和内容(如为假不能删除有内容的目录包括子目录)
Directory.GetDirectories 方法 //获取指定目录中子目录的名称
string[] dirs = Directory.GetDirectories(@"f:\\", "b*");
Console.WriteLine("此目录中以b开头的子目录共&leftsign;0&rightsign;个!", dirs.Length);
foreach (string dir in dirs) &leftsign; Console.WriteLine(dir); &rightsign;
Directory.GetFileSystemEntries //获取指定目录中的目录及文件名
Directory.GetLogicalDrives //检索此计算机上格式为“<驱动器号>:\\”的逻辑驱动器的名称,【语法同上】
Directory.GetParent //用于检索父目录的路径。
DirectoryInfo a = Directory.GetParent(path);
Console.WriteLine(a.FullName);Directory.Move //移动目录及其在内的所有文件
Directory.Move(@"f:\\bbs\\1", @"f:\\bbs\\2"); //将文件夹1内的文件剪到文件夹2内 文件夹2是刚创建的

Stream // 对字节的读写操作(包含对异步操作的支持) Reading Writing Seeking

BinaryReader和BinaryWriter // 从字符串或原始数据到各种流之间的读写操作

FileStream类通过Seek()方法进行对文件的随机访问,默认为同步

TextReader和TextWriter //用于gb2312字符的输入和输出

StringReader和StringWriter //在字符串中读写字符

StreamReader和StreamWriter //在流中读写字符

BufferedStream 为诸如网络流的其它流添加缓冲的一种流类型.

MemoryStream 无缓冲的流

NetworkStream 互联网络上的流

//编码转换
Encoding e1 = Encoding.Default;               //取得本页默认代码
Byte[] bytes = e1.GetBytes("中国人民解放军"); //转为二进制
string str = Encoding.GetEncoding("UTF-8").GetString(bytes); //转回UTF-8编码

标签:, , , ,
1005 skypemate USBPHONE 问题 USB HID - 三月 16, 2007 by yippee

1005 skypemate USBPHONE 问题 USB HID

发现问题:
除了USB手柄可以接收数据,其他的都收不到;除非开启SKYPEMATE,才能收到
估计要从头看USB协议和USB DDK?!

The Programs requirements for skyphone users 
   Software Download 
——————————————————————————–
Choose your computer system for Skyphone:
Windows Skype Mate software
 Windows SkypeMate Software
Turkish version Linux SkypeMate Linux Software (Fedora Core 3)   
 
 For Skype User
  Software Download 
Name Version Release date Memo Download
SkypeMate for Windows
 3.0.1.29 Aug 07, 2006 Support P1K,B2K,B3G,P4K, P4V, P5D,P8D,W1D,P6S,P6K 
SkyMACMate for MAC OS X  1.0.0.12 Aug 30, 2006 Support P1K,B2K,P4K,P5D P8D,W1D,P6S,P6K 
SkypeMate for Linux
  1.1.0.01 Sep 28, 2005 ZIP file For Fedora Core 3
Support USB-P1K & USB-B2K 
Skype for Windows 2.0.0.107 May 24, 2006   
Skype for MAC OS X 1.4.0.35 Jan 10, 2006   
Skype for Linux
 1.2.0.18 Oct 25, 2005 RPM for Fedora Core 3

动用了一些工具:
bus hound
1.请下载安装bus hound 5.0全功能版,在论坛上面有,自己去找2.安装完毕后请一定要重启,否则软件不能工作3.进行usb监控的主要步骤如下:(1)启动软件,讲usb设备插入usb口(2)在device内选择设备,例如我的设备是一个usb电话,则设备为usb composite device,选中该设备,可以在下面的properties看到设备的总线类型,设备的电源以及各个端点的功能,在该设备下面还有两个分支:usb audio device 和 "usb人体学输入设备"(这就是本设备占用的两个接口),一样在properties里面可以看到他们的类代码为0×01和0×03.(3)在看完基本信息后,将上述的某个接口,或者全部打勾.(4)切换到"setting"选项卡,将max phase设置为512,这样你就可以看到完全的descriptor和其他的数据了.(5)在"phase to capture"里面的几个和usb相关的选项如下:cdb:命令描述符块; ctl:usb控制传输; di/d数据输入/输出; len:数据长度; insoc:同步传输;rset:总线复位; urb:usb请求块; usts:usb状态查看usb数据传输就把它们都打勾就行了;(6)在"coloumn to display"里面,把里面的全部打勾,(为什么我就不说了).注意,这样要把窗体最大化才可以看见全部数据.(7)在"capture"选项卡里面可以看捕捉的数据了,在文本框输入文字,再点旁边的箭头,可以查询.按stop,再按start可以清屏.(8)举个例子,接上设备,在文本框输入get descriptor(大小写无所谓),点箭头,可以找到你的descriptor,但是值得注意的是这个descriptor主要是config,如果是设备描述符会有专门的说明get device descriptor;这个软件好像不会捕捉string descriptor.设备返回的信息在di里面4.希望大家有好资料也告诉我一声,谢谢!5.最后祝大家都顺利开发出usb设备…….

Sysnucleus USBTrace是一款强大而且易用的软件,用来分析USB总线和与之相连的USB设备的的连接状况,USBTrace可以监视USB主控制器,分线器,设备的运行,USBTrace特别适合检测主机方的USB控制协议
USBTrace : Software-only USB Protocol Analyzer

 
Order USBTrace online from our secure store Know USBTrace
 Take the USBTrace Tour Evaluate USBTrace
Download and try USBTrace evaluation version:

 Download USBTrace
USBTrace is an easy to use and powerful USB analyzer. USBTrace can monitor USB transactions at host controllers, hubs and devices. This is a 100% software product. USBTrace supports Windows 2000, Windows XP and Windows 2003 Server operating systems and works with USB 1.x and 2.0 (low, full and high speed) host controllers, hubs and devices.
USB Monitor是一款USB 连接端口监控软件,它可以让你查看,记录和分析USB 连接端口状况,捕获从 Windows 设备驱动程序向主控制器被传输,回来的所有请求程序块。分析在设备和设备驱动程序之间的协议。它具有以下特点:
一、 拦截所有透过USB 设备存取的资料;
二、 拦截及处理所有USB request blocks (URBs);
三、 支持资料记录,录制监控项目工作阶段,并于稍后播放;
四、 将资料格式化输出为不同格式,以便提供用户完整的信息;
五、 支持复制、汇出到剪贴簿功能;

USB Monitor is a professional tool for monitoring USB devices and any kind of application working with them on Windows platform.

USB Monitor allows you to intercept, display, record and analyze all the data transferred between any USB device connected to your PC and applications. It can be successfully used in application development, device driver or hardware development and offers the powerful platform for effective coding, testing and optimization.

This product, which is developed by professionals in the area of USB communications, will help you to save time, money and precious nerves, as it already helped our partners.

We will take care of monotonic digging in protocols and data flows. Concentrate your brilliant skills on your project, do your job with pleasure!

USB Monitor是一个系统监视软件,用来协助分析、查看USB设备的活动状态。USB Monitor能够捕捉Windows下所有的设备请求和分析设备与设备驱动程序之前的通信状态。这个工具主要用于USB设备及相关驱动程序的开发、调试。

http://topic.csdn.net/t/20050531/16/4049120.html
如何识别USB端口!

http://topic.csdn.net/t/20041017/15/3463899.html
怎样编写一个在USB接口读写数据的程序?

我想做一个监控软件,能够监控USB上的设备的插拔情况,请问怎么做
http://topic.csdn.net/t/20050322/14/3871176.html

http://www.codeproject.com/useritems/HwDetect.asp
Detecting Hardware Insertion and/or Removal
By Sam NG.
A user-mode application to detect hardware add/remove with WM_DEVICECHANGE and RegisterDeviceNotification()

http://blog.csdn.net/iiprogram/archive/2006/03/29/643081.aspx
Resources for Developers of USB Devices in the
http://www.lvr.com/hidpage.htm#MyExampleCode

brought to you by Jan Axelson

Delphi检测GUID确定的设备是否在线
James Deng的专栏
放一些东西,一来可以温故而知新,再者希望能有助于朋友们^_^

http://kobe8laker.spaces.live.com/blog/cns!4C8987191E5E8E3F!883.entry
5月20日
毕业设计客户端程序 based on C
经过半年多的努力,我完成了我的本科毕业设计——USB Data Acquisition。简单的说就是一个通过USB实现的数据采集系统。由于时间仓促,加上本人不会C++,所以只用C写了一个基本的HOST程序。下面介绍一些我的程序,摘自我的毕业设计报告客户端设计的一小部分:

http://bbs.zndev.com/htm_data/9/0606/112309.html
不接USB鼠标,HID设备能读写,接上就找不到设备

http://www.pediy.com/bbshtml/bbs7/pediy7-422.htm
使用OllyDbg 分析 USB HID 设备接口协议

http://bbs.chinaecnet.com/dispbbs.asp?Boardid=3&ID=36035&rootID=36035
请教关于USB HID设备应用的问题

Ollydbg 中断方法浅探-各种断点常识知识
HID CLASS FAQ
 
Sending and Receiving Reports under Windows

标签:, , , , ,
1003 USBPHONE 资料 WINVER - 三月 14, 2007 by yippee

1003 USBPHONE 资料 WINVER

NOTE: WINVER has been defined as 0×0500 or greater which enables
Windows NT 5.0 and Windows 98 features. When these headers were released,
Windows NT 5.0 beta 1 and Windows 98 beta 2.1 were the current versions.
For this release when WINVER is defined as 0×0500 or greater, you can only
build beta or test applications.  To build a retail application,
set WINVER to 0×0400 or visit http://www .microsoft .com/msdn/sdk
to see if retail Windows NT 5.0 or Windows 98 headers are available.
See the SDK release notes for more information.

问题是这样的  
  我在  
  class   CMainFrame   :   public   CFrameWnd  
  &leftsign;  
  ……  
  //中定义了一个函数  
  public:  
  bool   DoRegisterDeviceInterface(GUID       InterfaceClassGuid,HDEVNOTIFY   *hDevNotify);  
   
  //这个函数在msdn有,实际是RegisterDeviceNotification的一个例子  
  //其中的两个参数,我又分别定义成了,类的私有成员  
   
  private:  
  GUID   InterfaceClassGuid;  
                    HDEVNOTIFY   *hDevNotify;  
  //在理它们的定义已经包含在windows.h中,包括RegisterDeviceNotification  
  //但是编译的时候,却说  
   
  error   C2061:   syntax   error   :   identifier   \’HDEVNOTIFY\’  
  error   C2065:   \’hDevNotify\’   :   undeclared   identifier  
  error   C2065:   \’RegisterDeviceNotification\’   :   undeclared   identifier  
  等一系列错误  
   
  应该如何解决呢?这是什么原因造成的??谢谢了  

#include   "Winuser.h"
不是在#include   "Windows.h"中已经包含了Winuser.h"了吗?
这与你的操作系统有关,你可以看看Winuser.h的2643行如下  
  #if(WINVER   >=   0×0500)  
  typedef     PVOID                       HDEVNOTIFY;  
  typedef     HDEVNOTIFY           *PHDEVNOTIFY;  
   
  #define   DEVICE_NOTIFY_WINDOW_HANDLE           0×00000000  
   
  WINUSERAPI  
  HDEVNOTIFY  
  WINAPI  
  RegisterDeviceNotificationA(  
          IN   HANDLE   hRecipient,  
          IN   LPVOID   NotificationFilter,  
          IN   DWORD   Flags  
          );  
  WINUSERAPI  
  HDEVNOTIFY  
  WINAPI  
  RegisterDeviceNotificationW(  
          IN   HANDLE   hRecipient,  
          IN   LPVOID   NotificationFilter,  
          IN   DWORD   Flags  
          );  
  #ifdef   UNICODE  
  #define   RegisterDeviceNotification     RegisterDeviceNotificationW  
  #else  
  #define   RegisterDeviceNotification     RegisterDeviceNotificationA  
  #endif   //   !UNICODE  
   
  WINUSERAPI  
  BOOL  
  WINAPI  
  UnregisterDeviceNotification(  
          IN   HDEVNOTIFY   Handle  
          );  
  #endif   /*   WINVER   >=   0×0500   */  
typedef     PVOID                       HDEVNOTIFY;  
  typedef     HDEVNOTIFY           *PHDEVNOTIFY;  
  //在這個之前加入上面的..估計是個  

#if(WINVER   >=   0×0500)   就是這個其作用

请注意#if(WINVER   >=   0×0500)此处,而在windows.h有如下定义  
  #ifndef   WINVER  
  #define   WINVER   0×0400  
  #else  
  #if   defined(_WIN32_WINNT)   &&   (WINVER   <   0×0400)   &&   (_WIN32_WINNT   >   0×0400)  
  #error   WINVER   setting   conflicts   with   _WIN32_WINNT   setting  
  #endif  
  即你未定义WINVER,则系统定义为0×0400  
  解:  
  在StdAfx.h添加  
  #define   WINVER   0×0500  
   
   
  如  
  #if   _MSC_VER   >   1000  
  #pragma   once  
  #endif   //   _MSC_VER   >   1000  
   
  #define   VC_EXTRALEAN //   Exclude   rarely-used   stuff   from   Windows   headers  
  #define   WINVER   0×0500  
  即可  

标签:, , , , ,

1002 USBPHONE 资料 检测 - 三月 13, 2007 by yippee

1002 USBPHONE 资料 检测

USB 读写 编程

最近倒腾USBPHONE,出现两个问题
一个手柄可以接收到USB人体输入设备的数据,另外一个不行
可以检测到U盘的热插拔,但是手柄的检测不到

先记录一下资料:
关于USB插拔的 :
http://www.yippeesoft.com/blog/p/0903WM_DEVICECHANGESHFileOperation.php
0903 WM_DEVICECHANGE SHFileOperation

觉得是不是应该加上 接收到WM_DEVICECHANGE时,怎样才能判断是否为自己要关心的设备?
结果出现:
error C2065: \’DEV_BROADCAST_DEVICEINTERFACE\’ : undeclared identifier

需要 add   #define   WINVER   0×0500   before   #include   <dbt.h>
加上:
#ifdef WINVER
#undef WINVER
#endif
#define   WINVER   0×0500

结果:error C2065: \’HDEVNOTIFY\’ : undeclared identifier
倒腾啊,暂时记录一下资料吧

Skype网关—SkypeMate G90特点:                           
     * SkypeMate G90是一个Skype 网关,利用电脑USB接口实现Skype电话与传统电话网络的转接。
     * 可以将Skype网络电话转接到普通电话机或普通手机,可以市话的费用呼叫G90所在地区的任何固定电     话或手机。
    *  可以将手机打来的电话转接到Skype电话,当您不在电脑旁边时,也可以通过手机与您的Skype好友进行通话。
    * 支持二次拨号,可以把skype免费网络电话与企业内部的交换系统PBX连接起来。实现企业内部没有电脑的员工也可以通过分机拨打、接听skype电话。
    *  通过PC机的USB供电,无需额外电源,即插即用。
    *  采用DSP技术,具有回音消除功能。
    *  体积:94mm(L)×69 mm(W)×25 mm(H)。
  skype网关的作用
      Skype语音网关的作用,是把通话范围局限于互联网的skype免费网络电话以及skype out固话拔打功能两者使用时,通话双方至少必需一方在线),与传统电话网络连接起来,实现通话双方不在线的全球任何两部普通电话机之间的通话。它是帮助您建立“私有国际电话局”的核心硬件产品。

用WM_DEVICECHANGE得到插入USB设备的消息,为什么会得到好几条,并且如何区分插入和拔出。

——————————————————————————–
see WM_DEVICECHANGE wParam:

DBT_DEVICEARRIVAL
DBT_DEVICEREMOVECOMPLETE
… …
——————————————————————————–
那为什么一下子会响应好几条的呢?

——————————————————————————–
这是因为USB设备往往会“重枚举”(Renumeration),
就是软件模仿设备的拔下,再插上。
是设备的驱动决定的。
——————————————————————————–
只注册设备接口通知。如下:
DEV_BROADCAST_DEVICEINTERFACE filter;
filter.dbcc_size = sizeof(filter);
filter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
filter.dbcc_classguid = GUID_INTERFACE_PNPEVENT;
m_hInterfaceNotification = RegisterDeviceNotification(GetSafeHwnd(), &filter, DEVICE_NOTIFY_WINDOW_HANDLE);

要处理的是如下的通知:
OnDeviceChange(UINT nEventType, DWORD dwData)
&leftsign;
_DEV_BROADCAST_HDR* p = (_DEV_BROADCAST_HDR*) dwData;
if (p->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE)
&leftsign; switch (nEventType)
     &leftsign; // process device interface notification
      case DBT_DEVICEARRIVAL://新增
break;

      case DBT_DEVICEREMOVECOMPLETE://移走

break;
&rightsign; // process device interface notification
return TRUE;
     &rightsign;
&rightsign;

LRESULT CTestUSBDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) &leftsign; if(message == WM_DEVICECHANGE) //0×8000,0×8004 &leftsign; CString str; DEV_BROADCAST_HDR* dhr = (DEV_BROADCAST_HDR *)lParam; switch(wParam) &leftsign; case DBT_CONFIGCHANGECANCELED: TRACE(“DBT_CONFIGCHANGECANCELED“); break; case DBT_CONFIGCHANGED: TRACE(“DBT_CONFIGCHANGED“); break; case DBT_DEVICEQUERYREMOVE: TRACE(“DBT_DEVICEQUERYREMOVE“); break; case DBT_DEVICEQUERYREMOVEFAILED: TRACE(“DBT_DEVICEQUERYREMOVEFAILED“); break; case DBT_DEVICEREMOVEPENDING: TRACE(“DBT_DEVICEREMOVEPENDING“); break; case DBT_DEVICETYPESPECIFIC: TRACE(“DBT_DEVICETYPESPECIFIC“); break; case DBT_QUERYCHANGECONFIG: TRACE(“DBT_QUERYCHANGECONFIG“); break; case DBT_USERDEFINED: TRACE(“DBT_USERDEFINED“); break; case DBT_DEVICEARRIVAL: if(dhr->dbch_devicetype == DBT_DEVTYP_VOLUME) &leftsign; PDEV_BROADCAST_VOLUME lpdbv = (PDEV_BROADCAST_VOLUME)dhr; if(lpdbv->dbcv_flags & DBTF_MEDIA) &leftsign; str.Format(“Drive %c 插入“, FirstDriveFromMask(lpdbv ->dbcv_unitmask)); //AfxMessageBox(str); &rightsign; else &leftsign; char ch = FirstDriveFromMask(lpdbv ->dbcv_unitmask); str.Format(“%c:\\\\“,ch); &rightsign; &rightsign; break; case DBT_DEVICEREMOVECOMPLETE: if(dhr->dbch_devicetype == DBT_DEVTYP_VOLUME) &leftsign; PDEV_BROADCAST_VOLUME lpdbv = (PDEV_BROADCAST_VOLUME)dhr; if(lpdbv->dbcv_flags & DBTF_MEDIA) &leftsign; str.Format(“Drive %c 拔除“,FirstDriveFromMask(lpdbv ->dbcv_unitmask)); &rightsign; else &leftsign; str.Format(“Drive %c 拔除“,FirstDriveFromMask(lpdbv ->dbcv_unitmask)); &rightsign; //AfxMessageBox(str); &rightsign; break; default: break; &rightsign; &rightsign; return CDialog::WindowProc(message, wParam, lParam); &rightsign;

USB 驱动程序可以到注册表里面找到:
"HKEY_LOCAL_MACHINE\\\\SYSTEM\\\\ControlSet001\\\\Enum\\\\USB\\\\Vid_厂家标识&Pid_产品标识\\\\驱动程序"

里面的 ClassGUID 就是驱动程序的 GUID 标识, 例如 &leftsign;36FC9E60-C465-11CF-8056-444553540000&rightsign;
相当于程序的: DEFINE_GUID(USB_DRIVER_GUID, 0×36FC9E60,0xC465,0×11CF,0×80,0×56,0×44,0×45,0×53,0×54,0×00,0×00);
另外在这个注册表键里面还可找到有关设备的其他描述, 例如 DeviceDesc = "USB Mass Storage Device" 等

标签:, , , ,
0929 smartphone 2003 vs2005 sms 开发资料 - 三月 10, 2007 by yippee

0929 smartphone 2003 vs2005 sms 开发资料

[hide]最近看到人家有需求,想做一个短消息处理程序,对于指定人发送的短消息可以在TMAIL.EXE之前抢先接收保存。
找了找资料,最近手头不空,[/hide]

如何能从smartphone或PPC中的Inbox里面读取出SMS
Simmgr.lib  Simmgr.h 没记错的话是这样的,你在C#中只能用Invoke方法来实现
我在微软的网页上看到是利用IMailRuleClient的方法来实现

在PocketPC2003或smartphone2003里,如何去截获一条短信?一定要在系统里的那短信程序收到之前截获.POCKET PC 2003 SDK里有一个例子(C:\\Program Files\\Windows CE Tools\\wce420\\POCKET PC 2003\\Samples\\Win32\\Mapirule

(原创)CE MAPI实例讲解 — 如何获取Inbox里的所有消息(一)
无聊客的专栏 寻找逝去的岁月
如何获取tmail(就是我们熟称的收件箱程序)下各个Message Box下的消息

Receiving SMS Messages Inside a Managed Application Maarten Struys PTS Software
Summary: In this article we describe a way to receive SMS messages in a managed application without the SMS message appearing in the Inbox and without showing a bubble notification when the SMS message arrives. The sample code will run on a Pocket PC 2003 Phone Edition device. With small modifications, mainly in the MMI part, it should run on a Smartphone 2003 as well.

在托管应用程序内部接收SMS消息
2005.11.09  来自:MSDN开发精选  Maarten Struys
尽管.NET Compact Framework版本1.0提供了非常强大的功能,但是它对电话功能的支持却很少。使用P/Invoke,可以相当容易地访问Phone API和SIM API,如文章“Accessing Phone APIs from the Microsoft .NET Compact Framework”中所描述的那样。对于Windows Mobile 2003软件来说,如果SMS消息没有出现在收件箱中,则没有直接的API可用来立即处理在托管应用程序内部接收的SMS消息。SDK文档引用IMailRuleClient接口来处理应用程序内的传入消息。MAPI规则客户端(MAPI Rule Client)是可以实现IMailRuleClient接口的COM对象。注册时,收件箱应用程序将会加载MAPI规则客户端。注册后,传入的SMS消息会传递给MAPI规则客户端,由它决定如何处理该传入消息。
    Smartphone 2003 SDK和Pocket PC 2003 SDK中附带了很多代码示例。其中的一个示例实现了简单的邮件规则客户端。它位于Pocket PC 2003 SDK的子文件夹“\\POCKET PC 2003\\Samples\\Win32\\Mapirule”中。对设备进行注册后,该示例MAPI规则客户端会接收所有的SMS消息,并将它们传递给收件箱(包含字符串“zzz”的消息除外)。这些消息由MAPI规则客户端本身进行处理,以便在MessageBox中显示消息和发件人的电话号码,然后删除SMS消息

关于在PPC上接收短信的奇怪问题
在PPC上发送接收短信应该是很简单的问题,因为微软提供了Sim.lib库……
主题的问题解决了,主要是mobile自己的一个名为tmail.exe的线程,占用了接收短信的句柄。所以我们已经无法打开了……
现在又有另一个问题,对于收普通的短信没有问题。但我的目的是收PUSH的消息。不

在托管应用程序中接收 SMS 消息发布日期: 11/30/2004 &line; 更新日期: 11/30/2004
Maarten StruysPTS Software
适用于:Microsoft® .NET Compact Framework 1.0Microsoft® Visual Studio® .NET 2003
下载接收 SMS 示例。
摘要:在本文中,我们说明了一种在托管应用程序中接收 SMS 消息的方法,而 SMS 消息不会出现在收件箱中并且当 SMS 消息到达时不显示弹出通知。示例代码将运行在 Pocket PC 2003 Phone Edition 设备上。只要稍加修改(主要在 MMI 部分中),它应该也可以运行在 Smartphone 2003 中。
What Others Are Downloading
Others who downloaded .NET Compact Framework Sample: Receiving SMS Messages also downloaded:
.NET Compact Framework Sample: Send SMS
.NET Compact Framework Sample: Phone API
.NET Compact Framework Sample: Serial Communications
2556 Course Sample: Learn to Build Mobile Applications with Visual Studio and the .NET Compact Framework
.NET Compact Framework 2.0 Service Pack 1 Redistributable

IMailRuleClient is a COM interface – you cannot implement it in .NETCF, you must use eVC++ to create a dll to intercept SMS messages. You can use a number of techniques to pass this data to a managed program, e.g. use a messagewindow in your .NETCF application and have the dll broadcast a specific message when the SMS arrives.

Accessing Phone APIs from the Microsoft .NET Compact Framework 
Derek Mitchell DEVBUZZ.COM, Inc. April 2003
Applies to:    Microsoft® .NET Compact Framework 1.0    Microsoft Visual Studio® .NET 2003
Summary: Learn how to access Phone APIs from your .NET Compact Framework-based application.

VS2005 RC中,开发本地代码的Smartphone程序,用设备进行debug的问题
当用VS2005开发程序时,如果这样做会出现错误:
用C++开发基于Smartphone的本地代码程序
试图在实际设备上进行调试(直接Ctrl+F5运行没有问题)
出现错误为:
无法进行调试,VS2005报告错误。
解决办法:
把C:\\Program Files\\Microsoft Visual Studio 8\\SmartDevices\\SDK\\SDKTools\\sdkcerts.cab拷贝到设备上,运行该文件。然后重新启动设备。

标签:, , , , , ,