hi,
I am sending u bits of the code. Its kinda clumsy. But i hope u understand
it.
Thanks.
Veena
struct myrec
{
char *id;
char name[25];
char married[10];
char sex[8];
char adds[30];
char age[4];
};
DmOpenRef dbref;
int offsetrec;
myrec record;
UInt16 at;
switch(eventP->data.ctlSelect.controlID)
{
case AddrecExitbutButton:
dbref=DmOpenDatabaseByTypeCreator(DBTYPE,CREATORID,dmModeReadOnly);
if(!dbref)
FrmCustomAlert(DummyAlert,"error","","");
at=DmNumRecords(dbref);
UInt recs=0;
//WinDrawChars(at,12,12);
for (int i=0;i<at;i++)
{
MemHandle n= DmQueryRecord(dbref,i);
s=(myrec *) MemHandleLock(n);
test=s->id;
MemHandleUnlock(n);
FrmCustomAlert(DummyAlert,test,"","");
//recs=recs+1;
s=NULL;
}
DmCloseDatabase(dbref);
break;
case AddrecMarPopTrigger:
FrmHandleEvent(FrmGetActiveForm(),eventP);
break;
case AddrecSavebutButton:
//DmCloseDatabase(dbref);
dbref=DmOpenDatabaseByTypeCreator(DBTYPE,CREATORID,dmModeReadWrite);
if(!dbref)
FrmCustomAlert(DummyAlert,"error","","");
// packrec();
field1= (FieldPtr) GetObjectPtr(AddrecIDField);
MemHandle han=MemHandleNew(10);
record.id=(CharPtr) MemHandleLock(han);
StrCopy(record.id,FldGetTextPtr(field1));
field1= (FieldPtr) GetObjectPtr(AddrecNameField);
StrCopy(record.name,FldGetTextPtr(field1));
field1= (FieldPtr) GetObjectPtr(AddrecAddressField);
StrCopy(record.adds,FldGetTextPtr(field1));
field1= (FieldPtr) GetObjectPtr(AddrecAgeField);
StrCopy(record.age,FldGetTextPtr(field1));
con= (ControlPtr) GetObjectPtr(AddrecMalePushButton);
if(CtlGetValue(con))
StrCopy(record.sex,"Male");
else
StrCopy(record.sex,"Female");
con= (ControlPtr) GetObjectPtr(AddrecMarPopTrigger);
StrCopy(record.married,CtlGetLabel(con));
FrmCustomAlert(DummyAlert,CtlGetLabel(con),"","");
at=DmNumRecords(dbref);
//record.test=FldGetTextPtr(field1);
FrmCustomAlert(DummyAlert,record.id,"","");
VoidHand q= DmNewRecord(dbref,&at,sizeof(myrec));
rec=(myrec *) MemHandleLock(q);
DmWrite(rec,0,&record,sizeof(record));
//((UInt)&(((myrec *)0)->test))
//offsetrec=offsetrec + sizeof(myrec);
MemHandleUnlock(q);
DmReleaseRecord(dbref,at,true);
// at=at+1;
DmCloseDatabase(dbref);
break;
----- Original Message -----
From: "Aaron Peter" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Friday, September 14, 2001 12:04 PM
Subject: Re: Memory manager error
> Hi,
> Please paste ur code !
>
> -Peter
>
> Saraswathy wrote:
>
> > hi,
> > What do i do..That doesnt seem to be the problem..and if it is..what do
i
> > do.
> > -Veena
> >
> > ----- Original Message -----
> > From: "Aaron Peter" <[EMAIL PROTECTED]>
> > To: "Palm Developer Forum" <[EMAIL PROTECTED]>
> > Sent: Friday, September 14, 2001 11:11 AM
> > Subject: Re: Memory manager error
> >
> > > Hi,
> > > Maybe ur using some pointers to store values. So when u come next
> > time ur values maybe lost !
> > >
> > > -Peter
> > >
> > > Saraswathy wrote:
> > >
> > > > Hi,
> > > >
> > > > While running the program on the emulator i get an error
> > > >
> > > > The first time I run the application on the emulator its runs fine,
but
> > the
> > > > second time I encounter this error. Given Below
> > > >
> > > > "Starter 1.0 has just read directly from memory manager data
structures"
> > > >
> > > > Kindly help
> > > >
> > > > Regards,
> > > > Saraswathy
> > > >
> > > > --
> > > > For information on using the Palm Developer Forums, or to
unsubscribe,
> > please see http://www.palmos.com/dev/tech/support/forums/
> > >
> > >
> > > --
> > > For information on using the Palm Developer Forums, or to unsubscribe,
> > please see http://www.palmos.com/dev/tech/support/forums/
> > >
> >
> > --
> > For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/