vHandles.bat | https://ammaze.net/xywwweb/dls/vhandles.zip
C.L.Distefano rev. 2025-11-28

A utility for users who run XyWrite for DOS in vDosPlus,
  Wengier Wu's DOS emulator for Windows

Purpose
-------
When vDosPlus runs XyWrite for DOS, it opens--but does not subsequently
close--a profusion of file handles. This "handle leak" eventually causes
the editing session to crash with the error message "Maximum number of
Windows search handles exceeded". vHandles.bat tracks these extraneous
handles and issues a warning message when the vDosPlus session is close
to crashing. This gives you an opportunity to save open files and quit
and restart XyWrite in a safe and orderly way.

It is also possible to automate the quit/restart by setting User
Variable "_xyQuitKey" and assigning an appropriate routine to the
corresponding key in your XyWrite keyboard file. QUITS.PM, included
in vhandles.zip, is an example of such a routine and is designed to
work in all versions of XyWrite and NotaBene for DOS. There is a
one-time setup: read QUITS.PM in XyWrite's eXPanded view. (In brief, you must (1) assign QUITS.PM to a key in your XyWrite keyboard file and (2) add this key to User Variable "_XyQuitKey" in vHandles.bat, using the naming system noted there.)

vHandles.bat uses Sysinternals utility handle64.exe or, for 32-bit
Windows, handle.exe. Both these files are included in vhandles.zip.
vHandles.bat detects the operating system architecture and runs the
appropriate utility.

Included Files
--------------
In addition to vHandles.bat, vhandles.zip includes the following
files:
- handle.exe and handle64.exe, Windows Sysinternals utilities to
    list and optionally close handles
- echos.exe, enhanced Echo command
- msgbox.exe, Windows message box utility
- sendkeys.exe, send keystrokes to a specified window
- winmove.exe, window positioning/sizing utility
- QUITS.PM, XPL routine to quit & restart XyWrite, compatible with
    all versions of XyWrite and NotaBene for DOS
- vHandles.txt, this ReadMe file

Setup
-----
Unzip vhandles.zip (all files) into a directory of your choosing.
At a Windows command prompt, switch (ChDir) to the directory with
vHandles.bat -- do not skip this step! -- and then command:
  start "vHandles" vHandles.bat

vHandles.bat is designed to run continuously, consuming minimal
resources. It issues its crash warning one time only per vDosPlus
session, then sleeps until a new vDosPlus session is detected.

Tip
---
The initial value set in User Variable "_maxHandles" is 500. If
you continue to encounter the Windows "handles exceeded" error,
edit this User Variable to set a lower number.

-- 
C.L.Distefano
New York City
28 Nov. 2025
