Skip to content
This repository was archived by the owner on Aug 23, 2025. It is now read-only.

VM class

David Simunič edited this page Oct 18, 2018 · 6 revisions

VM class

The VM class (in VM.cs) defines an object that holds important information about a particular virtual machine. This includes:

  • name (Name)
  • description (Desc)
  • path (Path)
  • window handle (hWnd)
  • state (State)
  • and PID (Pid)

The first three should be obvious in meaning. hWnd is a Win32 window handle (actually an IntPtr) that allows the Manager to interact with the main 86Box window that belongs to the specific VM. Status is an integer that tells us the status that the VM is currently in. Pid is also an integer and tells us which process ID represents the current VM.

The class also defines four constant integers to make the status more friendly.

  • STATUS_STOPPED (0) - VM is stopped
  • STATUS_RUNNING (1) - VM is running
  • STATUS_IN_SETTINGS (2) - VM is running, but only the settings window is displayed (-S parameter for 86Box)
  • STATUS_PAUSED (3) - VM is running, but it's paused

Please note: if Status is 0 (STATUS_STOPPED), the values stored in hWnd and Pid are not guaranteed to be accurate and must not be used! They're updated once status changes from 0 to something else and then should be accurate. It may or may not be possible to enter an undefined state where a running VM may have an invalid hWnd and/or Pid, or even a wrong status. This will be solved if it's ever confirmed to be possible.

There are two constructors, the default one, and one that takes four arguments (first three values above + Status). There's also a ToString() override and GetStatusString, which returns an appropriate string for each of the possible statuses (this is useful in the UI).

Clone this wiki locally