Problem with IDisplay.SetSeamlessMode

Discussion about using the VirtualBox API, Tutorials, Samples.
Post Reply
batyr
Posts: 13
Joined: 14. Aug 2014, 16:17

Problem with IDisplay.SetSeamlessMode

Post by batyr »

Hello.
I develop on C#.
I'm trying to switch VirtualBox to SeamlessMode throughout IDisplay.SetSeamlessMode with runing VM, but it's not working. Can anyone help me?

Code: Select all

VirtualBoxClient vboxclient = new VirtualBoxClient();
IMachine machine = vboxclient.VirtualBox.FindMachine("VM");
Session session = vboxclient.Session;
try 
{
	machine.LockMachine(session, LockType.LockType_Shared);
	session.Console.Display.SetSeamlessMode(1);
}catch (Exception e){MessageBox.Show(e.Message);}				
} finally {
	if (session.State == SessionState.SessionState_Locked) session.UnlockMachine();
}
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Problem with IDisplay.SetSeamlessMode

Post by noteirak »

When running the code, what do you get? any error? or it just complete without doing anything?
Does it work if you try from the GUI instead?

Also, given the reference about IDisplay::SetSeamlessMode(), you need to have the display facility, which you can check in IGuest. What is the value for it?
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
batyr
Posts: 13
Joined: 14. Aug 2014, 16:17

Re: Problem with IDisplay.SetSeamlessMode

Post by batyr »

noteirak wrote:When running the code, what do you get? any error? or it just complete without doing anything?
Does it work if you try from the GUI instead?

Also, given the reference about IDisplay::SetSeamlessMode(), you need to have the display facility, which you can check in IGuest. What is the value for it?
Thanks for the prompt response.
Yes, it completes without doing anything. No error returned.
If I do it from GUI (Ctrl+L) it does work and switches to seamless mode, no problem.
I did check the FacilityStatus (AdditionsFacilityStatus status = session.Console.Guest.GetFacilityStatus(AdditionsFacilityType.AdditionsFacilityType_Seamless, out l);) and it returns: status = AdditionsFacilityStatus_Active.
So status seems to be correct.
However the API doesn't switch VM to seamless mode. What should I do next?
See the atached for the code snipped:

Code: Select all

IMachine machine = MainForm.vboxclient.VirtualBox.FindMachine("VM");					            
			Session session = MainForm.vboxclient.Session;
            try
            {
                machine.LockMachine(session, LockType.LockType_Shared);
                long l = 0;
                AdditionsFacilityStatus status = session.Console.Guest.GetFacilityStatus(AdditionsFacilityType.AdditionsFacilityType_Seamless, out l);

                session.Console.Display.SetSeamlessMode(1);
                session.Console.Display.InvalidateAndUpdate();               

            }
            catch (Exception ex) { }
            finally
            {
                if (session.State != SessionState.SessionState_Null && session.State == SessionState.SessionState_Locked) session.UnlockMachine();
            }
batyr
Posts: 13
Joined: 14. Aug 2014, 16:17

Re: Problem with IDisplay.SetSeamlessMode

Post by batyr »

RESOLVED (in fact DEAD END). See the ticket response https://www.virtualbox.org/ticket/13759
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Problem with IDisplay.SetSeamlessMode

Post by noteirak »

I was just about to offer you to open a ticket. I ran some tests (wanted to run more) and I saw that pattern too.
Thank you for posting the link to the ticket, hopefully the devs can have a look at it.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Problem with IDisplay.SetSeamlessMode

Post by noteirak »

I've updated your link to point to the right ticket. You've posted a link to the second one you made, which does not have the conclusion.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Post Reply