I have written a C# code, that modifies the registry before starting the application of your choice
The code itself is good, but I believe there are some details missing, to actually toggle between them flawlesly
On my computer VirtualBox started without any problems and YouWave became unresponsive (after startup), with some button-images missing (maybe that's a clue of what went wrong here). I think there are some minor details missing in what's needed to toggle between the 2, possibly another registry setting or somehing else. But
I won't continue development, because of the need to use YouWave on a day-to-day basis, I can't afford it being non-responsive.
This (Bèta) application can easily be recreated in Visual Studio:
If used on a 32-bit system, modify win64 to win32
Create a project called:
- YouBox
Just add 2 buttons:
- btnVbox
- btnYouwave
In the designer double click the form and the buttons... to create the Click and Load events
And paste the code below:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
//Added Namespaces
using System.IO;
using Microsoft.Win32;
using System.Diagnostics;
using System.Security;
namespace YouBox
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//Registry Root
RegistryKey rg = Registry.ClassesRoot;
//Registry Path (change this to win32 if on 32-bit computer)
string key = @"TypeLib\{46137EEC-703B-4FE5-AFD4-7C9BBBBA0259}\1.3\0\win64";
//Program Files (32 and 64 bit)
string PGx86 = @"C:\Program Files (x86)";
string PG = @"C:\Program Files";
//Executable Files
string youwave = @"\YouWave_Android\YouWave_Android.exe";
string vbox = @"\Oracle\VirtualBox\VirtualBox.exe";
//Conflicting DLL Files
string youwaveDLL = @"\YouWave_Android\vb\VBoxC.dll";
string vboxDLL = @"\Oracle\VirtualBox\VBoxC.dll";
//CHECK IF REGISTRY IS ACCESSIBLE
private void Form1_Load(object sender, EventArgs e)
{
//Try to open Registry key
try
{
rg = rg.OpenSubKey(key, true);
}
//If it fails to open registry key, report user to Run as Administrator
catch (SecurityException)
{
MessageBox.Show("Run as Administrator");
return;
}
}
//YOUWAVE BUTTON
private void btnYouwave_Click(object sender, EventArgs e)
{
//If YouWave application is in "Program Files (x86)" register DLL and start YouWave
if (File.Exists(PGx86 + youwave))
{
rg.SetValue("", PGx86 + youwaveDLL);
Process.Start(PGx86 + youwave);
}
//If YouWave application is in "Program Files" register DLL and start YouWave
if (File.Exists(PG + youwave))
{
rg.SetValue("", PG + youwaveDLL);
Process.Start(PG + youwave);
}
//Close registry key
rg.Close();
}
//VIRTUALBOX BUTTON
private void btnVbox_Click(object sender, EventArgs e)
{
//If VirtualBox is in "Program Files (x86)" register DLL and start VirtualBox
if (File.Exists(PGx86 + vbox))
{
rg.SetValue("", PGx86 + vboxDLL);
Process.Start(PGx86 + vbox);
}
//If VirtualBox is in "Program Files" register DLL and start VirtualBox
if (File.Exists(PG + vbox))
{
rg.SetValue("", PG + vboxDLL);
Process.Start(PG + vbox);
}
//Close registry key
rg.Close();
}
}
}
PS: Just some extra info (For 64-bit users):
I just found out that Virtual Box registers itself under the win32 key
and Youwave is registered under win64, 2 seperate keys
SEE PICTURE:
http://i1073.photobucket.com/albums/w394/reconx86/Registry_win32_win64.png===========================================
Additional virtualbox observations (on 64-bit windows):
VirtualBox seems to change the contents of the
%USERPROFILE%\.VirtualBox folder
Services added:
vboxdrv service
Known registry keys that are added upon virtualbox install
HKEY_LOCAL_MACHINE\Drivers
HKEY_CLASSES_ROOT\TypeLib\{46137EEC-703B-4FE5-AFD4-7C9BBBBA0259}\1.3\0\win32
Known conflicting keys:
HKEY_CLASSES_ROOT\TypeLib\{46137EEC-703B-4FE5-AFD4-7C9BBBBA0259}\1.3\0\win64
Common conflict errors:
White screen
Initialization error: please reinstall youwave
FILE INCONSISTENT and then LICENCE CONSISTENCY ERROR
File inconsistency error & License inconsistency error