Your problem with the MemHandleUnlock in the second position is that you 
have just deleted that handle with the DmDeleteRecord.

What you want to do is like this:

for (recordNeuNum = 0; recordNeuNum < numRecordsNeu; recordNeuNum ++)
        {
        DmSeekRecordInCategory(gVeranstaltungNeuDB, &recordNeuIndex, 0, 
dmSeekForward, dmAllCategories);
        recordH = DmQueryRecord (gVeranstaltungNeuDB, recordNeuIndex);
        if (!recordH)
                {
                FrmCustomAlert(MyAlert, "Problem beim Auslesen der neuen DB!",
                "", "");
                err = DmGetLastErr();
                break;
                }
        else
                {
                pointer_auf_neue_v= (Veranstaltung_neu *)
                MemHandleLock(recordH);
                neueVeranstaltung = * pointer_auf_neue_v;

                // delete all old records.
                TimSecondsToDateTime (TimGetSeconds (), &dateTime);
                todayInt = ( ((Int32) dateTime.year-1904) << 16) +  ( ((Int32) 
dateTime.month) << 8) +  ((Int32) dateTime.day);
                dateInt = ( ((Int32) pointer_auf_neue_v->datum_jahr) << 16) + ( 
((Int32) 
pointer_auf_neue_v->datum_monat) << 8) + ((Int32) 
pointer_auf_neue_v->datum_tag);

                if (todayInt > dateInt)
                        {
                        MemHandleUnlock(recordH);       
                        err = DmDeleteRecord(gVeranstaltungNeuDB, recordNeuIndex);
                        deletedOldRecordsNum ++;
                        }
                else
                        {
                        // so now, every record is in the future..
                        // do some stuff with this record
                        MemHandleUnlock(recordH)
                        }
                }
        } // next in loop


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

Reply via email to