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

Commit ff566ea

Browse files
committed
Fixed issue #36
A proper error is now displayed when a non-existent VM is started via a shortcut. Also changed the "VM already running" messagebox to information.
1 parent 4023ffb commit ff566ea

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

86BoxManager/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
//
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
34-
[assembly: AssemblyVersion("1.3.1.0")]
35-
[assembly: AssemblyFileVersion("1.3.1.0")]
34+
[assembly: AssemblyVersion("1.3.2.0")]
35+
[assembly: AssemblyFileVersion("1.3.2.0")]

86BoxManager/frmMain.cs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -983,18 +983,27 @@ protected override void WndProc(ref Message m)
983983
//Get the VM name and find the associated LVI and VM object
984984
CopyDataStruct ds = (CopyDataStruct)m.GetLParam(typeof(CopyDataStruct));
985985
ListViewItem lvi = lstVMs.FindItemWithText(ds.Data);
986-
VM vm = (VM)lvi.Tag;
987986

988-
//If the VM is already running, display an error, otherwise, start it
989-
if (vm.Status != VM.STATUS_STOPPED)
987+
//This check is necessary in case the specified VM was already removed but the shortcut remains
988+
if(lvi != null)
990989
{
991-
MessageBox.Show("This virtual machine is already running.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
990+
VM vm = (VM)lvi.Tag;
991+
992+
//If the VM is already running, display an error, otherwise, start it
993+
if (vm.Status != VM.STATUS_STOPPED)
994+
{
995+
MessageBox.Show("The virtual machine \"" + ds.Data + "\" is already running.", "Virtual machine already running", MessageBoxButtons.OK, MessageBoxIcon.Information);
996+
}
997+
else
998+
{
999+
lvi.Focused = true;
1000+
lvi.Selected = true;
1001+
VMStart();
1002+
}
9921003
}
9931004
else
9941005
{
995-
lvi.Focused = true;
996-
lvi.Selected = true;
997-
VMStart();
1006+
MessageBox.Show("The virtual machine \"" + ds.Data + "\" could not be found. It may have been removed or the specified name is invalid.", "Virtual machine not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
9981007
}
9991008
}
10001009
base.WndProc(ref m);

0 commit comments

Comments
 (0)