[vbox-dev] Subject: Com api. Cannot use IDisplay. It's null
Ivo Smits
Ivo at UFO-Net.nl
Sat Mar 9 01:41:27 PST 2013
Hi,
VirtualBox 4.2 has introduced a new lock type for VM frontends:
LockType.LockType_VM. You have to use this lock type, otherwise the
Console related objects are not initialized.
Ivo
Op 9-3-2013 7:12, Pavel Murygin schreef:
> Hi everybody!
>
> I wrote a virtual box frontend in C# using com api. I haven't touched
> my code for about a year. During that year I've moved to a laptop from
> pc. Last time I ran my code it worked fine. Now I cannot access
> IDisplay because it's null;
> here is my code:
>
> var vb = new VirtualBoxClass();
> _machine = vb.FindMachine(machineName);
>
> var monitors = _machine.MonitorCount;
>
> Monitors = new MMFFrameBuffer[monitors];
> for (byte i = 0; i < monitors; i++)
> {
> var name = string.Format("monitor{0}", i + 1);
> Monitors[i] = MMFFrameBuffer.CreateNew(name)
> ;
> }
>
> _session = new SessionClass();
> _machine.LockMachine(_session, LockType.LockType_Shared);
>
> for (int i = 0; i < MonitorsCount; i++)
> {
> _session.Console.Display.SetFramebuffer((uint) i, Monitors[i]);
> }
>
> My program fails on the line where I'm trying to set framebuffer. I
> get NullreferenceException: _session.Console.Display is null.
> My current version of Vbox is the latest: 4.2.8 r83876. I can't
> remember the exact version on which my code ran correctly. I can only
> say It was the latest one about 1 year ago. Host OS is Win7 pro x64
> (same as it was on my previous PC)
>
> I'm completely clueless about my issue. Any help would be highly
> appreciated!
>
> Regrads,
> Pavel Murygin.
>
>
> _______________________________________________
> vbox-dev mailing list
> vbox-dev at virtualbox.org
> https://www.virtualbox.org/mailman/listinfo/vbox-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.virtualbox.org/pipermail/vbox-dev/attachments/20130309/db5a3e0d/attachment.html
More information about the vbox-dev
mailing list