Microsoft KB Archive/190972

= NotesDem.exe Reads and Writes the Contacts NOTES Field =

Article ID: 190972

Article Last Modified on 8/5/2004

-

APPLIES TO

 Microsoft Foundation Class Library 4.2, when used with:  Microsoft Visual C++ 5.0 Enterprise Edition

 Microsoft Visual C++ 6.0 Enterprise Edition

 Microsoft Visual C++ 5.0 Professional Edition

 Microsoft Visual C++ 6.0 Professional Edition</li></ul>

 Microsoft Visual C++ 6.0 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q190972

<div class="summary_section">

SUMMARY
NotesDem.exe is an MFC sample for Windows CE that demonstrates how to read and write the NOTES field of the Contacts Database using the RichInk control. The NOTES field in the Contacts application is not the same field as HHPR_NOTES used in the address card structure. Actually, it is not even part of the addresscard structure so you must use the Windows CE Database APIs to get access to it.

<div class="moreinformation_section">

MORE INFORMATION
The following files are available for download from the Microsoft Download Center:

NotesDem.exe

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

The property ID of the NOTES field is 0x170041. It contains binary data in the RichInk control format. There is an article "\Windows CE Platform SDK\Support\RichInk\RichInk.doc" that describes how to use the RichInk control.

Reading the NOTES field is not very difficult. The following code taken from NotesDemo.exe shows how you could read the field into a RichInk control: HANDLE h_contact; CEPROPVAL* propval; WORD propsrecv = 1; CEPROPID ceprops[] = {0x170041}; DWORD buflen = 0; PEGOID id = GetAddressCardOid(m_CardIndex); DWORD index;

h_contact=CeOpenDatabase(&contactsid,_T("Contacts Database"),0,0,NULL); CeSeekDatabase(h_contact,CEDB_SEEK_CEOID,id,&index);

if(!CeReadRecordProps(h_contact,CEDB_ALLOWREALLOC,&propsrecv, ceprops,(unsigne d char**)&propval,&buflen)) {     MessageBox(_T(" Failed to read data! ")); }

::SendMessage(m_hRichInkCtrl,IM_SETDATA,                (WPARAM)propval->val.blob.dwCount,                 (LPARAM)propval->val.blob.lpb); CloseHandle(h_contact); The NotesDem.exe sample also demonstrates how to write to the NOTES field.

NOTE: RichInk.h includes the calerror.h file. This file was not distributed with the Windows CE Toolkit for Visual C++ 5.0. This include can be commented out for the build. This control does not exist for the x86 emulation mode.

<div class="references_section">