Example Code

function CloseHandleEx(const hProcess: THandle; Handle: THandle): BOOL; stdcall; // Closes the specified object handle in the target process (UnLocker programs typically do this, however it can be useful for other reasons too) var hObject: THandle; begin hObject := 4; // Any handle value in the target process if not CloseHandleEx(GetCurrentProcess(), hObject) then MessageBoxW(0, 'Failed to Close Handle', nil, MB_ICONERROR) else MessageBoxW(0, 'Closed Handle Successfully', 'CloseHandleEx', MB_ICONINFORMATION); end;