20070608 YippeeSMSBK mpx220 短信 备份 SMARTPHONE
YippeeSMSBK mpx220 短信 备份 SMARTPHONE
短信备份的,用过几个人家的,有的是增量备份,每次生成单独的文件,有的是无法解析发件箱里面的收件人,全部显示成发件人
C# VC2005 SQLITE
完成功能
解析 收件人/发件人 时间 内容
读取收件箱 发件箱
收取之后删除短信SMS
存储于SQLITE
退出时备份
分邮箱浏览
按时间浏览
首先是 WINCE MAPI的问题
然后是VC2005作界面的问题
最后是C# SQLITE的问题
断断续续作了快一个星期
效率实在有些差了。
c#的效率的确比VC要差很多
以前用VC查询一个几十万条记录的SQLITE,速度明显飞快
而c#第一次打开数据库就明显延时严重
标签:mpx, mpx220, phone, rtp, smartphone, sms, 备份, 短信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 错误
标签:diff, for, form, Info, orm, phone, rtp, smartphone, vs2005, win, winform20070606 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.
标签:control, phone, rtp, smartphone, tree, vs200520070606 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;
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;
//寧땍乖쳬矜狼삿혤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;
//繫법OpenEntry삿혤IMessage뚤蹶
//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
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
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
标签:phone, rtp, smartphone, sql, sqlite, vs200520070503 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.
标签:.net, phone, rtp, smartphone, vc, vc.net, vs200520070811 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
标签:active, activesync, phone, rtp, smartphone, vs2003, vs2005, 模拟, 模拟器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编码
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拷贝到设备上,运行该文件。然后重新启动设备。
0602 SMARTPHONE MPX220 AUTOSHUTDOWN menu RC2
//
// TimeShutSP.RC2 – Microsoft Visual C++ 不会直接编辑的资源
//
#ifdef APSTUDIO_INVOKED
#error 此文件不能由 Microsoft Visual C++ 编辑
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// 在此处添加手动编辑的资源…
/////////////////////////////////////////////////////////////////////////////
HI_RES_AWARE CEUX &leftsign;1&rightsign; // 关闭模拟层
// 移除此资源可在平台上启用像素
// 加倍(但需平台提供支持)
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// 数据
//
IDR_MAINFRAME SHMENUBAR DISCARDABLE
BEGIN
IDR_MENU1,
2,
I_IMAGENONE, IDOK, TBSTATE_ENABLED, TBSTYLE_BUTTON &line; TBSTYLE_AUTOSIZE,
IDS_OK, 0, NOMENU,
I_IMAGENONE, IDR_MENU1, TBSTATE_ENABLED, TBSTYLE_DROPDOWN &line; TBSTYLE_AUTOSIZE, IDS_MENU1, 0, 0,
END
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MAINFRAME MENU
BEGIN
MENUITEM "sss", IDOK
MENUITEM "退出", ID_OL
END
IDR_MENU1 MENU
BEGIN
POPUP "df"
BEGIN
POPUP "ddd"
BEGIN
MENUITEM "rttttttt", ID_DDD_RTTTTTTT
END
MENUITEM "fgggggg", ID_DF_FGGGGGG
END
MENUITEM "fgfg", ID_FGFG
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_OK "eeeeee"
IDS_MENU1 "ddd"
END
0601 SMARTPHONE MPX220 AUTOSHUTDOWN menu
好久就计划写一个,一直比较懒惰,今天停电,想了想程序,准备作,结果发现出问题呢。VS2005 RTM版本
结果无论我怎么修改 菜单,界面上出现的还要那个标准的确定菜单,看看代码:
if (!m_dlgCommandBar.Create(this) &line;&line;
!m_dlgCommandBar.InsertMenuBar(IDR_MAINFRAME))
&leftsign;
TRACE0("未能创建 CommandBar\\n");
return FALSE; // 未能创建
&rightsign;
好像也没有什么问题啊,倒腾半天,看到网上有文章,原来如此啊
VS2005开发本地代码Smartphone程序,菜单编辑器有严重Bug
2005.10.21 来自:CSDN 侯月文
无论怎么编辑,编译出来的菜单都是默认的。因为RES目录的rc2资源文件VS2005没有改。总是这样的:
IDR_MAINFRAME SHMENUBAR DISCARDABLE
BEGIN
IDR_MAINFRAME,
1,
I_IMAGENONE, IDOK, TBSTATE_ENABLED, TBSTYLE_BUTTON &line; TBSTYLE_AUTOSIZE,
IDS_OK, 0, NOMENU,
END
所以,无论怎么编辑都不行。
解决方法:
先改一下这个文件再编辑菜单。
比如说,改成这样:
IDR_MAINFRAME SHMENUBAR DISCARDABLE
BEGIN
IDM_MENU,
2,
I_IMAGENONE, IDOK, TBSTATE_ENABLED, TBSTYLE_BUTTON &line; TBSTYLE_AUTOSIZE,
IDS_OK, 0, NOMENU,
I_IMAGENONE, IDM_MENU, TBSTATE_ENABLED, TBSTYLE_DROPDOWN &line; TBSTYLE_AUTOSIZE, IDS_MENU, 0, 0,
END
那么,需要在编辑器中创建一个ID为IDM_MENU的菜单条,再建立一个IDS_MENU的字符串资源,改字符串就是显示出来的菜单的名字。
经过后续查证,VS2005针对Smartphone的菜单编辑器就是这样设计的,也就是在菜单编辑器中编辑的只是菜单的内容,这些内容是保存在rc文件中的,而菜单条是作为RCDATA保存在rc2资源文件中。
其思路应该源于WM5.0对与菜单的全新设计。在WM5.0中,无论是ppc中的菜单还是sp中的菜单,都是一样的,即支持左右软键,左右软键分别可以弹出一个菜单。所以,微软认为这个东西不是菜单,是工具条,而真正的菜单是左右软键弹出的那个东西。所以,在菜单编辑器中编辑的是左右软键弹出的菜单,而在rc2文件中保存的是工具条的定义。
也就是说,我们把编辑菜单的问题称为Bug也好,称为其他也好,但是总而言之,现在基于Smpartphone和wm5.0的本地代码开发,对于“工具条”的定义需要我们自己手动完成了。
针对RCDATA的定义,有一些说明:
IDR_MAINFRAME SHMENUBAR DISCARDABLE
IDR_MAINFRAME是在程序中load工具条的ID,在resources.h中定义一个ID就可以了。
SHMENUBAR DISCARDABLE不清楚,照抄就可以了。
BEGIN
IDM_MENU,
IDM_MENU是在菜单编辑中编辑菜单的ID,此菜单对于smartphone2003来说,横向的定义只能有一项(且文字内容是什么无关紧要),因为smartphone2003只支持左右键中一个是弹出菜单。对于wm5.0来说,可以有两项(尚未验证)。
2,
1或者2,取决于要左键还是左右都要。
I_IMAGENONE, IDOK, TBSTATE_ENABLED, TBSTYLE_BUTTON &line; TBSTYLE_AUTOSIZE,
IDS_OK, 0, NOMENU,
如果是button性质的,要定义为TBSTYLE_BUTTON,并且最后是NOMENU。IDOK为在资源头文件中随便定义的ID就可以,IDS_OK对应的字符串资源是将来显示的内容。
I_IMAGENONE, IDM_MENU, TBSTATE_ENABLED, TBSTYLE_DROPDOWN &line; TBSTYLE_AUTOSIZE, IDS_MENU, 0, 0,
如果是弹出式菜单,定义为TBSTYLE_DROPDOWN,且最后一位为0。IDM_MENU为在资源头文件中随便定义的ID就可以。
END
END之后一定要加一个回车,否则编译报fatal error RC1004的错误。
更详细的内容,可以看一下这个网址:
http://blogs.msdn.com/johnkenn/archive/2005/08/22/454858.aspx
0523 mpx220 smartphone 桌面主题
看了好多主题,感觉还不错,不过用的不多,暂时先记录
发一个带快捷方式文字说明的XP桌面主题
此主题创意是别人的,自己重新做了个,并加上了程序快捷方式的文字说明.开始以为加个程序快捷方式的文字说明是很简单的,把最近使用程序快捷方式的文字说明搬过来就可以了,其实不然,是有区别的,不过现在好了.
建议把菜单内的程序快捷方式文件名改为中文,这样显示起来比较好.
附件: 新建文件夹 (2).rar (2005-8-10 00:38, 286.95 K)
实用主题(象电脑桌面)
在aya学到不少东西,东拼西凑做成了这个我现在用的主题,不知道有没有人喜欢。
附件: [附件] 电量内存.rar (2006-1-14 15:41, 926.62 K)
主题修改成功,感觉不错。
首先我得感谢 lzw645 版主的支持与帮助,修改了之前的主题,现在这样看起来还不错。
附件: [附件] 内存电量定位.rar (2006-2-4 22:39, 1 M)
XP桌面主题(含固定快捷方式,和电脑桌面一样)
一直想找个主题可以在桌面上固定几个“快捷方式”,可没有一个合意。经过参考个各论坛的资料终于做了一个超“干净、简单、实用“的主题。
先别废话看个效果先。大家如果觉得好的话,再详细说明更改各个”快捷方式“的方法。(毕竟每个人想要的程序都不一样,”快捷方式“的地址也不同。)
主题是绿色文件,直接拷贝到 \\Storage\\Application Data\\Home\\ 就可以了。
电池啊 我一块电池,用座冲充电鼓了 结果待机三天,还有75% 刚才接了一个5分钟电话,就只有60%了 别恐吓我,我这两个才两个月啊 用 旅充 充不饱 电池一个是送的 不会吧,我这个用了好久啊 就算水货那块也有两天半 有没有人买过E玄知音的那个 恒毅 套装 <?xml version="1.0" encoding="GB2312"?> <default font-face="nina" font-size="14" padding-left="4" padding-right="4" bgcolor="transparent" fgcolor="#ffffff" padding-top="2" b-border-color="COLOR_HOMERULE" b-border-width="0"> <!– RJShortcut –> <shortcutbar icon-spacing="3" icon-size="Small"> <shortcut target="\\Storage\\Windows\\Start Menu\\常用程序\\内存清理.lnk" /> </shortcutbar> </plugin> 潜水许久了 看到很多 香港连续剧 和张 连续剧 之争 这就是代沟吧 看小说的一代和看动漫的一代 香港的布景衣服场面的确垃圾。那么现在的人看到京剧的不是更加可笑 我觉得如同吃饭,有的人是吃情调,鲜花 蜡烛 白桌布 有的人吃味道,小巷子里面找 个人欢喜 题外话一个,说到战争场面,看了这么就电影电视,惟一射箭有点气势的就只有英雄了 不是那种一看就没有什么初速度的,估计只有半石的力气 当然,老外的不算,否则 勇敢的心 和 乱
nl6515 (东莞社区) 2006-05-22 13:48
电池鼓了,就意味着要下岗了^_^
我用座冲充到绿灯亮红灯灭 就鼓了
softygl (深圳社区) 2006-05-22 13:52
那谁叫你经常用座充呢。
nl6515 (东莞社区) 2006-05-22 14:04
可能的原因,一是电池太水;二是座充太水,缺乏完善保护电路,而这正是锂电池必须的。
座冲是送的飞毛腿的?还是MPX220专用的
谁知道哪个有问题~
鼓了有一个好处:后盖紧了~
还有一个是随机器的
用座冲充水货,一个晚上,第二天鼓了
后面一直用旅充,总是觉得不对头
我基本没有什么电话,一下子就用完了
用座冲实验,结果绿灯亮 也鼓了
nl6515 (东莞社区) 2006-05-22 14:15
电池一旦鼓了,就算充饱,也最多只能用一天,还不能接多点电话。以前我就有过同样的经历,而且电池自放电快。结果是下岗。
效果如何?谢谢!
简单的说一个主题XML文件由默认段代码+配色段代码+插件代码组成。
打开XML文件,最上面大段代码我们称它默认段,是一个主题各方面的默认设置,插件代码里没有特别设置,主题就调用默认设置,里面最主要的是要知道主题背景图的路径设置在这里
<home>
<author>shengfang</author>
<title>XP桌面</title>
<version>1.0</version>
<format state="selected" fgcolor="#ffffff" />
</default>
<background bgimage="\\IPSM\\Application Data\\Home\\Home.jpg" valign="top"/>
</home>
<plugin clsid="&leftsign;F3750050-8E30-4c61-A864-4301F5D7C065&rightsign;">
<background b-border-width="0">
<format state="selected" valign="bottom" bgimage="\\IPSM\\Application Data\\Home\\1.jpg"/>
</background>
<format padding-left="4" padding-top="0" padding-bottom="1" />
<shortcut target="\\Storage\\Windows\\Start Menu\\Settings.lnk"/>
<shortcut target="\\Storage\\windows\\Start Menu\\电话相关\\短信.lnk"/>
<appname x="220" y="0" font-size="14" fgcolor="#ffffff">
<format state="selected" fgcolor="#ffffff" x="60" font-weight="400"/>
</appname>
1。明白主题是插件和桌面的联系人或桥梁(为了形象点的比喻)。
2。主题是由主题XML文件和图片组成。真正的联系人或桥梁是XML文件中的插件代码。
3。一个主题XML文件由默认段代码+配色段代码+插件代码组成。
4。从上而下一段段的插件代码表现在屏幕上是从上而下一行行插件内容。
5。根据插件和屏幕之间从上而下的一一对应,很容易在XML文件中找出某插件的代码。
6。明白了一一对应的位置关系,就很容易根据屏幕的位置在XML文件中替换,删除,添加插件代码,从而实现根据自己需要来改主题布局。
7。明白一些插件代码的通用基本参数,通过修改参数来实现按自己需要改变主题文字的大小,颜色,局部位置。
8。平时收集些插件代码和配色代码,到时候根据需要挑几段插件代码,挑段配色代码一组合加上背景图,一个主题就诞生了。
9。特殊插件特殊研究,根据前面的方法先把它搬上屏幕再说,然后慢慢琢磨研究试验特殊参数。
10。做主题需要参考的文章不要看太多,容易乱,按我说的思路来,大胆上手,处理代码要细心,别丢三拉四。推荐2篇必用的文章,
1.阿才写的XML基础参数含义
2.hoverni 整理的关于主题xml文件中的配色代码含义
好了,写完了,也累了,以后想到什么再补充或更新。有看不明白或有错误的地方跟帖提问.
0528 smartphone 主题 制作 资料
smartphone 主题 制作 Microsoft Smartphone Theme Generator
smartphone智能手机主题第三方插件汇总
作者:冬天减肥 点击:
名称:LcdPlug 作用:在桌面上显示动态时钟指针 名称:RJshortcut 作用:RJ快捷方式插件,可以用它来自定义程序及其快捷方式的静态图标。名称:RJHTML Plugin 作用: RJ HTML网页插件,可以使主题具有HTML网页特性,可以用来显示农历、GIF动画,动画屏幕尺寸有限制,不能实现HTML网页的上下滚动。
名称:RJTime Plugin 作用: RJ时钟插件,可以显示模拟时钟,并可以自定义时钟背景。名称:CalendPlug 作用:在桌面上显示日历与星期 名称:Battery Pack 作用:在桌面显示电量内存信息.系统图标 名称:MediaPlug 作用:显示MeiaPlayer的简洁操作面板 名称:Alarmplug 作用:在桌面上显示闹钟插件
名称:ScrPlug 作用:改变开关机画面 名称:LMDPlug 作用:改变开关机音乐 一款电池插件,这个插件还可以换皮肤,大家也可以自己做,bmp格式的,替换\\Storage\\Application Data\\Home下的原文件就行了 名称:RJTasks Plugin 作用: RJ任务插件。天气预报插件 首先要开通GPRS申请该项再装插件才能显示。
名称:Oxios Tasks Plugin–Oxios任务插件.作用:可以滚动显示多个任务。Oxios Today Plugins for SmartPhone 1.5
Smartphone手机主题制作软件
最好的Smartphone手机主题制作软件,解压安装后双击Sn.reg文件即可xx,然后复制
english.lng到安装目录Program FilesRuttensoftHomescreen DesignerLanguage下覆盖原文件即可汉化,此版本为最新版!
喜欢自己动手的朋友可以试一下,DIY的乐趣无穷!
附件: Smartphone手机主题制作软件.part1.rar (800 K) 下载次数:64
【教学】主题制作教程、制作工具、插件综合索引!
一楼:主题修改制作入门(包括制作工具)
三楼:XML文件中配色各值的意思及演示
四楼:常用主题插件及简要说明
22楼:常见的国外主题网站
制作工具:
1、微软官方的SP主题制作软件Theme Generator Smartphone:
这是一个所见即所得的应用程序,具有强大的功能。可以随心更换桌面、图标、铃声、时间日期、mail、MMS等等工作界面 。
系统要求: .net框架的PC(Win2000/XPSP1和XPSP2, 不支持Windows 95/98/ME)。分辨率不小于1024×768。(如果你的软件安装完成不能运行,请安装Microsoft NET.Framework 1.1) ,SP系统要求Windows Mobile 2003 (SE)(不支持2002)
2、手机主题工作室:
需要Microsoft .NET Framework 2.0软件包的支持。
主要功能:
1.制作smartphone系统的手机桌面主题,可立即在模拟窗口中显示所作的修改;
3、QVGA专用主题制作软件—-HomeAnimBuilder
4、将网上的hme格式的主题修改为绿色主题:
2. Homescreen Designer for Smartphone 2003 Version 1.1.4是新兴的桌面主题专门制作工具,也是PC上运行,功能更强,使用稍微复杂些。这个软件也支持配色方案的调整,支持自定义主题图片,并支持开关机、开始菜单等背景图片的修改,除了可以使用SP系统标准插件外,还提供了对几个第三方插件的支持,可以自定义插件极其位置、尺寸等。
完全版】微软官方的SP主题制作软件Theme Generator Smartphone简体中文汉化版
【分享】【汉化】主题制作工具homescreendesigner1.3.2(包含汉化文件及注册机)
主题制作器是一个所见即所得的应用程序,具有强大的功能。可以随心更换桌面、图标、铃声、时间日期、mail、MMS等等工作界面
Alarm Plugin: 时钟插件。LCDPLugv1.51:LCD插件,可以实现酷酷的LCD效果。Oxios Hibernate 1.30:释放SP上的内存。 Oxios Plugins 1.43:在屏幕上显示任务。
RJShortcut Plugin:RJ快捷方式插件,可以用它来自定义程序及其快捷方式的静态图标。 RJTasks Plugin:RJ任务插件。
RJTime Plugin:RJ时钟插件,可以显示模拟时钟,并可以自定义时钟背景SmartMonitor:智能监控插件,可以显示电量、温度、存储和内存等参数。
Smartbatt Plugin:电池插件,可以显示电池电量和温度。Camera Phone Enabled Home Screen:桌面上显示照相簿里面的照片。最新的屏幕插件 Home Screen Animation Plugin:实现动画桌面的插件
1:媒体播放器插件,可以给桌面主题添加媒体播放功能,在桌面上直接实现播放、暂停等操作 2:闹钟插件~~AlarmPlug2003 3:日历插件 4:RJ任务插件(RJTasks Plugin)5:在桌面可以滚动显示多个任务插件。OxiosTaskPlugins 6:释放内存插件(OxiosHibernate)7:RJ模拟时钟插件(RJTime Plugin)
8:显示存储器,内存,电量,温度等数据插件SmartMonitor 9:LCD插件。Lcdplugv1[1].51 10:快捷方式插件可以自定义程序的图标rjshortcut 11:相册插件(Storage Card.My Documents.My Photos)12:12宫格主题插件(可以为每一个程序安排一个背景图片,实现纵向多页) 13:数字时钟,秒表,倒计时,定时器插件;RJV_Clock 14:开关机音乐插件。LMDPlug 15:桌面实现动态字幕、播放GIF动画、农历等网页特效插件 18:Dopodo官方插件 19:允许修改开关机画面插件 20:可调用其他插件可同时定义插件的高度宽度可增加横向 21:LCD插件中文版1.51 22:MBAnimPlug动态主题插件 FacadeBeta
LCD插件lcdplugv1.53