如何控制Contacts

buptpki 2003-10-20 04:14:57
在Smartphone中,进入Contacts中后,通过上下键在点亮相应的人名后,按Action键后,就可以显示这个人的详细信息,如:电话,办公地址,手机号,E-mail地址,但是在程序中如何切换到这个界面。

For example, our application implements a contacts navigator function. If user says a name and our application recognizes the result, the program needs directly display the detail property, like that user selects Contacts in home or Programs menu, chooses the name, and presses action key. The same problem appears in Task, Calendar, Inbox, etc.

From Section 'Pocket Outlook Object Model (POOM) API' of smartphone 2002, POOM API defines all Display interface methods, but not implemented, same as smartphone 2003.

So, currently, our primary problem of UI is what's the interface that directly displays the detail information about respective item.

当前我的实现办法是,通过FindWindow查找Contacts窗口,没有Contacts,就通过CreateProcess激活,否则,BringWindowToTop,
由于它是一个ListView控件,查找每个Item,直到找到相应的Item,SendMessage个KeyDown消息,这个过程是一串KeyDown消息构成,效率太低。
而且由于Win32的管理机制,我的程序和Contacts程序不再同一个地址空间,无法获得进一步的控制,微软也不打算公布Contacts的源代码,即使OEM厂商。

所以不知道那位大虾有这方面的资讯,在此,先感谢了
...全文
60 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
buptpki 2003-10-22
  • 打赏
  • 举报
回复
很抱歉,可能我没说清楚,通过Poom我已取得各种数据,假若我自己画个列表框,显示这些数据,没问题,很简单。Smartphone 2003提供的Sample代码也给出例子了。

关键是,这样会有两套GUI,微软自己提供的Contacts, 以及我自己开发的一套,这样会迷惑用户,使用起来不方便,而且占用过多的资源。

所以,我想直接利用微软提供的Contacts,把自己的代码和他无缝结合起来,比方说,在Contacts,用户移动up & down, highlight一个Item, 我的TTS模块可以读出这个人的Detail infomation, 当然,程序更进一步,利用语音识别技术,识别出一个人名,直接highlight这个Item, 或者现实Detail information, 或者用TTS模块给出结果,这样盲人也可以使用手机了。
buptpki 2003-10-22
  • 打赏
  • 举报
回复
Microsoft Windows CE 3.0

IContact::Display
This method is not supported in Windows CE Platform Builder 3.0.

This method displays a Contact item. You can display a Contact item only immediately after creating it or reading it from the object store.

HRESULT Display();
Return Values

S_OK indicates that the Contact item was displayed successfully, and if the user made changes, that the changes were saved correctly. If an error occurs, the appropriate HRESULT value is returned.

Requirements

Runs On Versions Defined in Include Link to
Windows CE OS 2.0 and later pimstore.h

See Also

IContact::Unknown, IContact Property Methods


链接地址:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesdkr/html/_wcesdk_icontact_display.asp

不知道是否有类似的Display()函数,不管是com机制或者.net机制。
944136 2003-10-21
  • 打赏
  • 举报
回复
其实你可以参考英文版的说明,使用POOM API,就可以完全控制Pocket PC上的Contacts/Tasks/Alarm等等Outlook方面的内容。
944136 2003-10-21
  • 打赏
  • 举报
回复
MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppc2k/html/ppc_oom.asp


Program Your Own Contacts Application with eMbedded Visual Basic

PocketContacts is a program I created that gives you the tools and techniques you need to build a more powerful contact management application using eMbedded Visual Basic.
What You Need
Microsoft® eMbedded Visual Basic® installed on your PC.
The Pocket PC software development kit (SDK) installed on your PC.
The Microsoft eMbedded Visual Tools emulator to test your software.
All of these tools are available on the eMbedded Visual Tools CDs. If you don't already have a copy of these tools, you can order them for free or download them from Microsoft. In addition, this program is available completely built and ready to install from my personal Web site. You can take a look at the source code there, as well.

Why Undertake This?
Why go through this process at all… Good question! Basically, I'm always tempted to add functionality to commercial software.
In this case, I wanted to add specific features. My contacts are all categorized, and if I can only sort them by one field at a time, then I can't make use of the various categories.

Features and Techniques
This program provides features above and beyond the standard Contacts software, including:
Sorting
Filtering
Varied fonts
User defined fields in columns
It also demonstrates the following eMbedded Visual Basic programming techniques:

Advanced POOM (Pocket Outlook Object Model) programming
Pop-up menus
Progress bars
Sorting
The basic Contact software that comes with the Pocket PC only shows your information sorted one way, using the File As field. This field is usually composed of Last Name followed by First name or Company Name, depending on the data.
The main routine in PocketContacts is called LoadContacts. It's located in the form called ContactForm. The following code snippet shows how easily you can sort your information:

Set ContactList = polApp.GetDefaultFolder(olFolderContacts).Items
Select Case ContactSort
Case "f":
Call ContactList.Sort("[FirstName]", False)
Case "l":
Call ContactList.Sort("[LastName]", False)
Case "c":
Call ContactList.Sort("[CompanyName]", False)
End Select

All you need to do is specify the field name using the .Sort verb. How simple it is!

Filtering
Filters are essentially a view, which can include or exclude one or more categories of information from your display (see Figure). For example, you might want a filter called OKCustomers where you include only contacts that have a category of Excellent or Good. In addition, you can specify that you want the information sorted a certain way, and that in the second column you show the contact's e-mail address.

The options available when you apply a filter.



User Defined Columns
One of my favorite ways to increase the usability of software is to provide as many options as possible. This lets you really customize the environment to your liking. For example, why should you be required to see the phone number in the second column of the list, when you could choose?
Well, a little routine called GetField in the ContactForm allows just that. Using a filter, the user selects the field they want to display in a given column, using a combo list. The number (0—28) corresponding to the field is then passed to the GetField routine as each line is displayed and the corresponding Contact field is shown. The following fields are permitted:

Function GetField(fnum As Integer) As String
Dim s As String

Select Case fnum
Case 0: s = polItem.Anniversary
Case 1: s = polItem.Birthday
Case 2: s = polItem.BusinessFaxNumber
Case 3: s = polItem.CompanyName
Case 4: s = polItem.Department
Case 5: s = polItem.Email1Address
Case 6: s = polItem.MobileTelephoneNumber
Case 7: s = polItem.OfficeLocation
Case 8: s = polItem.PagerNumber
Case 9: s = polItem.BusinessTelephoneNumber
Case 10: s = polItem.JobTitle
Case 11: s = polItem.Email2Address
Case 12: s = polItem.Spouse
Case 13: s = polItem.Email3Address
Case 14: s = polItem.Home2TelephoneNumber
Case 15: s = polItem.HomeFaxNumber
Case 16: s = polItem.CarTelephoneNumber
Case 17: s = polItem.AssistantName
Case 18: s = polItem.AssistantTelephoneNumber
Case 19: s = polItem.Children
Case 20: s = polItem.WebPage
Case 21: s = polItem.Business2TelephoneNumber
Case 22: s = polItem.RadioTelephoneNumber
Case 23: s = polItem.FileAs
Case 24: s = polItem.Title
Case 25: s = polItem.FirstName
Case 26: s = polItem.MiddleName
Case 27: s = polItem.LastName
Case 28: s = polItem.Business2TelephoneNumber
End Select

GetField = s

End Function

You could include other fields, as well, but these are the ones I chose to make available.

Pop-Up Menus
Another readily available technique is that of pop-up menus. These routines use the Microsoft Windows® CE 3.0 SDK and show some simple ways you can use them. These routines are encapsulated in a module called popmenu.bas.
Progress Bar
Finally, I've seen people looking for a Microsoft ActiveX® control to show a progress bar. This is very easy to do using the eMbedded Visual Basic grid control. Just create a grid with one row and 100 columns. Then change the background color of each column (0—99), and watch your progress!
Conclusion
This project is a great start into the world of advanced eMbedded Visual Basic Pocket PC programming. It demonstrates many possible user interface features. In addition, it uses several advanced programming techniques that you can re-use in any other projects you're working on.
There's plenty of room for extending this program, as well. For example, you could add colors based on category, or permit any of the columns to show any field. The possibilities are endless. My goal here is to demonstrate that advanced programming on the Pocket PC using eMbedded Visual Basic is not only possible, but also easy and fun.

Enjoy!



多参考Microsoft 中的MSDN.

19,502

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 嵌入开发(WinCE)
社区管理员
  • 嵌入开发(WinCE)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧