At 6:12 PM +0000 12/11/02, mlv srinivas wrote:
mh = DmQueryRecord( db, index );
pText = (char*)MemHandleLock(mh);
WinDrawChars(pText,StrLen(pText),width,height);
height=height+10;

MemPtrUnlock( pText );
DmReleaseRecord( db, index, true );
It would be easier to figure this out if you had told us what line in the posted code generates the error, and also the relationship between FrmInit and the posted code (called after FrmDrawForm?).

Are you sure that your data records are null-terminated? Your call to WinDrawChars assumes this.

What happens if DmQueryRecord fails? (although in this example I don't see how it could fail)

What happens if you have more than 14 records in your database? You're drawing off the screen. Table is a better bet for this form.

DmReleaseRecord should not be called after DmQueryRecord, only after DmGetRecord. And there's no reason for you to set the dirty bit, since you aren't modifying the record when you display it. If you change the call from DmQueryRecord to DmGetRecord your code would force the subsequent synchronization/backup of every record in the database, each time this form is viewed.


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

Reply via email to