Converts a string representation of a handle to a valid handle. If the string does not correlate to a valid handle in the session, the function returns 0.
The following procedure creates a frame, stores the handle of the frame as a string value, deletes the frame, converts the string representation of the frame handle back to a valid handle, and then tests if the handle is valid:
r-widhd.p
DEFINE VARIABLE whand AS HANDLE NO-UNDO. DEFINE VARIABLE chand AS CHARACTER NO-UNDO. CREATE FRAME whand. chand = STRING(whand). DELETE WIDGET whand. whand = HANDLE(chand). MESSAGE VALID-HANDLE(whand) VIEW-AS ALERT-BOX INFORMATION BUTTONS OK. |
The VALID-HANDLE function returns a FALSE value because the frame was deleted and the handle is no longer valid.