Hi all,
I need help debugging this little code snippet.

/*global*/ DmOpenRef     dbToUse;

void static MyFunction();
 MemHandle     recordH;
 Char               *recText;
{
    recordH = DmGetRecord(dbToUse, indexToGet);
    if (recordH == NULL)
        ErrDisplay("Can retrieve record");
    recText = (Char*)MemHandleLock(recordH);
}



dbToUse has been opened by
DmOpenDatabaseByTypeCreator(MenuProtoUserDBType, CreatorID, mode);
elsewhere. I'm pretty sure the dbToUse is opened for reading, I've even
checked it with

 error = DmOpenDatabaseInfo(dbToUse, &dbID, &openCount, &mode, &cardNo,
&resDB);
 ErrFatalDisplayIf(error, "Database not opened");

The problem is whenever I try to lock recordH with
MemHandleLock(recordH); I get "MemoryMgrNew.c, Line:4177, Free handle"
on the log window.
recText would then point to some invalid address space.

Is a free handle an invalid handle? A freed handle? Doesn't
DmGetRecord() return a handle? Or do I have to explicitly use a
recordH=MemHandleNew(x)? But I wouldn't know how much memory to assign
for DmGetRecord.

Any help would be greatly appreciated. Thanks!!

Wee Meng CHONG








-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to