The only way is to study source code.

Almost everything important should be located in adressdb.c and adressdb.h

When records are stored in database, they are in packed format. (see
addressdb.c, PrvAddrPackedDBRecord)

To work with record you have to call AddrDBGetRecord(DmOpenRef dbP, UInt16
index, AddrDBRecordPtr recordP, MemHandle *recordH) to obtain pointer to
record and locked handle
    -> dbp - reference to open adress book database
    -> index - index of record you want retrieve
    <- recordP - pointer to structure you use to manipulate with record
    <- recordH - pointer to handle to record memory
Comments:
    recordH is locked by this function and remain locked, until you
explicitly unlock it(it completely your responsibility)
    recordP->options specifies which field(phone1 to phone5) represent which
phone
        For example phone1 may be assigned workLabel (The value may be only
from AddressPhoneLabels)
        phone1 is the first text you see under Company in Address Edit form
    recordP->fields array of pointers to null terminated strings represented
information suplied by user for specific contact.
        !!! it points directly to database, so use it with care
        How to obtain firstname:
        if(recordP->fields[firstName])    // check if firstName was
specified
                                                        // firstName is
member of enum used to access fields (AddressFields)
        {
            StrCopy((char*)destination,recordP->fields[firstName]);    //
use it
        }
        !!! remember you may work like this while recordH is locked, after
unlock of recordH, recordP is not valid

To create new record call AddrDBNewRecord(DmOpenRef dbP, AddrDBRecordPtr r,
UInt16 *index);

If you want to tamper with record try Err AddrDBChangeRecord(DmOpenRef dbP,
UInt16 *index, AddrDBRecordPtr r, AddrDBRecordFlags changedFields)
I believe comments in sources are sufficient to work with it(see start of
function declaration).

Sorry, but i have not more time to explain other points.
I think this should be enough for begining.

see more comments bellow

<[EMAIL PROTECTED]> wrote in message news:95200@palm-dev-forum...

Hello,

I have to make a program which can put a new record in the datebook as we
are in the datebook program. Then I would like to know how it is possible to
insert a new record in the datebook database when I am in my application, I
have open the datebook source code but I don't understand how is the
database.

What are the fields of this database?
// at the  beginning bitmap of used fields, and then null terminated string
according to bitmap one for each fields (see PrvAddrPackedDBRecord in
adressdb.c)

When I will open the database what must I do to insert a new record as we
were on the datebook program.
// use their functions for creation, modification and saving of records

Must I change another thing to make the new record compatible with datebook
program and with Palm desktop when we synchronise?
// hmmm, hard to say, probably no

Thanks in advance,

Regards

Helene
------------------------------------------

Faites un voeu et puis Voila ! www.voila.fr






-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to