C API - Testing handle for validity

Is there any rock solid, safe way to test a db handle (say one obtained from an open note using NSFNoteGetInfo(hNote, _NOTE_DB, &hDB). I’ve tried OSLockObject and NSFDbReopen without success. Testing for NULL is of course simple, but how to safely test for validity?

Any ideas?

Subject: C API - Testing handle for validity

I would suggest testing the return-status of the call that created the handle.

Subject: RE: C API - Testing handle for validity

Unfortunately, NSFNoteGetInfo doesn’t return STATUS, it’s signature is:

void LNPUBLIC NSFNoteGetInfo(

NOTEHANDLE  note_handle,

WORD  note_member,

void far *value_ptr);

Hence the question.

Subject: RE: C API - Testing handle for validity

There are two functions which supposedly were added in Notes 6.5.6 and Notes 7.0.3, and were shown in betas for 8.0.0, but they are not in the Notes 8.0.0 C API headers, so I don’t know the real story. In any case, they don’t seem to be in earlier versions of ND 6.5 or ND 7, so they would be of limited use. In any case, here they are (from the public Notes 8 beta version of the C API - note that the DHANDLE would be HANDLE in earlier versions).

BOOL far PASCAL OSMemoryHandleValid (MEMHANDLE handle);

BOOL far PASCAL OSIsHandleValid(DHANDLE handle);

Subject: RE: C API - Testing handle for validity

Thankyou Ben & Rob for the information.