Properties

< BACK  NEXT >
[oR]

Properties are used to store data, and are defined by two characteristics:

  • A unique numeric property identifier for the field. This is equivalent to field names in standard databases, and the same value is used for the same property in all records.

  • Data type, a constant defining the type of data held in the property. The allowed values are shown in Table 4.5.

Table 4.5. Property types and constants
Constant C data type Description
CEVT_I2 short Two-byte integer
CEVT_UI2 USHORT Unsigned two-byte integer
CEVT_I4 long Four-byte integer
CEVT_UI4 ULONG Unsigned four-byte integer
CEVT_FILETIME FILETIME Structure containing date/time
CEVT_LPWSTR LPWSTR Pointer to Unicode string
CEVT_BLOB CEBLOB Binary large-object structure
CEVT_BOOL BOOL True/False value
CEVT_R8 double Eight-byte floating point

The property identifier and data type are combined together in a ULONG value to define the CEPROPID for the property. For example,

 const CEPROPID propCompany = MAKELONG(CEVT_LPWSTR, 100); 

You can choose any value for the property identifier, as long as it is unique for the properties in the database.

A property in a database is accessed through the CEPROPVAL structure:

 typedef struct _CEPROPVAL {   CEPROPID propid;   WORD wLenData;   WORD wFlags;   CEVALUNION val; } CEPROPVAL; typedef CEPROPVAL *PCEPROPVAL; 

The propid member is assigned the CEPROPID value created for the field, as shown above. The val member is a union used to store the value associated with the property. The member wLenData is not used, and wFlags is used when property values are retrieved or deleted.

So, you might write the following code to create a CEPROPVAL structure ready for writing to the database.

 CEPROPVAL propValCompany; propValCompany.val.lpwstr = _T("My Company"); propValCompany.propid = propCompany; propValCompany.wFlags = 0; 

< BACK  NEXT >


Windows CE 3. 0 Application Programming
Windows CE 3.0: Application Programming (Prentice Hall Series on Microsoft Technologies)
ISBN: 0130255920
EAN: 2147483647
Year: 2002
Pages: 181

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net