BWIValidHandle – Check for a valid handle

BWIValidHandle (h, valid)

Use BWIValidHandle to check whether a handle is valid.

Input parameter

h Handle that you want to check.

Output parameter

valid Long integer. This returns 0 if the handle is valid. If the handle is invalid, this returns one of the following:
BWI_H_FREED The variable could have once been valid but the handle has already been freed and so can no longer be passed into an API call.
BWI_H_INVALID The variable is invalid because it is not a value that could ever be used by a handle. The most likely cause of this error is using a variable that has not been passed to BWICreateHandle.
BWI_H_NOMEM The handle is invalid because no memory was available for BWICreateHandle to allocate. This is because either the maximum number of handles has already been allocated or there is no system memory available. To determine the reason, compare the maximum number of handles and the number currently allocated using BWIGetRuntime with item BWI_R_MAX_HANDLES and BWI_R_NUM_HANDLES.