VirtualBox (and other Hypervisor) permit a guest OS to operate simultaneously within the existing host OS. However, the primary goal is to provide compatibility on the OS level and not on an application level. VirtualBox offers “seamless mode” that allows for merging of the host and guest desktops together (sort of) … but falls short of integrating into the host user desktop environment. (In fairness, they don't even try)
Here is a method of using “VirtualBox” to start a VM with a minimalistic filesystem that has the proprietary application installed in it. Allowing you to create menu entries or desktop icons within your host user desktop environment to start the application. Seamlessly displaying and functioning within the host user desktop environment … without using the guest UI.
For the purpose of this paper I will be working from a Ubuntu 10.10 host OS and merging a Windows XP proprietary application into my gnome user desktop environment.
Video: http://www.youtube.com/watch?v=5KJJmmrHlg0]
Prerequisites:
Host OS with VirtualBox installed and working
Guest OS with additions installed and working
First, we need to setup the guest OS to be used as a embedded VM. To do this we need to setup auto login. This will allow our WinXP to just start into a desktop. If you used a user name and password, you will need to remember these credentials for latter use. If you have setup using blank passwords, you will need to read this.
To make everything nice and clean, there are three little utilities for the XP guest OS. The first two make the taskbar and progman invisible. The third creates a small window to fix a problem with seamless window mode and the background getting refreshed correctly. Each of these programs are created using Autoit3 and compiled. Put them into the c:\windows\system32 folder so that they are in the path. Here are the scripts;Also, to use accounts without or with an empty password, the guest's group policy must be changed. To do so, open the group policy editor on the command line by typing gpedit.msc, open the key Computer Configuration\Windows Settings\Security Settings\Local Policies\Security Options and change the value of Accounts: Limit local account use of blank passwords to console logon only to Disabled.
taskbar.au3:
Code: Select all
; Check the state of the taskbar
$state = WinGetState("[CLASS:Shell_TrayWnd]", "")
; Is the taskbar "visible"?
If BitAnd($state, 2) Then
WinSetState("[CLASS:Shell_TrayWnd]", "", @SW_HIDE)
Else
WinSetState("[CLASS:Shell_TrayWnd]", "", @SW_SHOW)
EndIf
Code: Select all
; Check the state of the progman
$state = WinGetState("[CLASS:Progman]", "")
; Is the progman "visible"?
If BitAnd($state, 2) Then
WinSetState("[CLASS:Progman]", "", @SW_HIDE)
Else
WinSetState("[CLASS:Progman]", "", @SW_SHOW)
EndIf
Code: Select all
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Seamless = GUICreate("Seamless", 1, 1, 0, 26, $WS_POPUP, 0)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
Wend
Finally, we want to close the guest OS while in the seamless window mode. In the guest OS, switch into seamless window mode. Then use the start->shutdown to shutdown the VM. You will also want to disable the mini toolbar. In VM Settings->General->Advanced->Mini Toolbar find “show in fullscreen/seamless” and uncheck it. Restart the VM … after it restarts everything should disappear and only show you the Linux desktop.
Next, we need to create shell scripts on the host OS to start our software on the VM (since we have hidden the windows user interface.) Here is an example for the notepad.exe application. (~user is you user folder)
~user/bin/notepad:
Code: Select all
#/bin/sh
VBoxManage guestcontrol execute WinXP "notepad.exe" --username Administrator
The biggest drawback to this setup is if you minimize the guest application … it is invisible and unaccessible. As a work around, I use autoit3 (in the guest OS) to prevent the guest application from being minimized. You can also create a shell script for the taskbar.exe utility to expose the windows taskbar when needed.
~user/bin/taskbar:
Code: Select all
#/bin/sh
VBoxManage guestcontrol execute WinXP "taskbar.exe" --username Administrator