Workaround for OCX State Problem (VMRC Active X)

26. April 2007 04:31 by Csaborio in General  //  Tags: ,   //   Comments (0)

On a previous post I was having problems with the VMRC ActiveX control when creating an instance at runtime.  The problem boiled down in having an invalid OCX state exception thrown at me whenever I tried to access a property of the VMRC ActiveX control at runtime.

After researching for quite a while on the Internet, it struck me that if I just placed the VMRC ActiveX in a UserControl at Design time, and instantiated that UserControl instead of the ActiveX directly, things would work great.  I implemented this into the VMCA application and it worked perfectly fine.   You can see I managed to get VMRC connections to different machines in different tabs at runtime on this post.

Some people have asked where they can get a copy of the VMCA.  Unfortunately as of now, the application hasn't been thoroughly tested and is missing some functionality which I deem as basic.  Also, this is something I have been working on my spare time and lately I have been swamped with other projects.  Perhaps the best approach would be to take it to stable phase and then try and get it on CodePlex so that everyone can pitch in...we'll see how that goes.

For all things related to software migration, be sure to visit Artinsoft's website. For training in Visual Basic to C# migrations, Visual Basic to VB.Net, Virtualization, and 64-bit training check our training web page.

Virtual Machine Configuration Assistant

13. April 2007 06:07 by Csaborio in General  //  Tags: ,   //   Comments (0)

As I previously mentioned, I've had some chance of working on the application dubbed as the Virtual Machine Configuration Assistant in the last few days.   One of the most noticeable changes are the GUI.  This is the old GUI of the app:

ZZ6A980B2C

This is the revamped, improved version:

ZZ1AC07DEE

The application has undergone major revisions under the hood.  I have tried to separate tasks into different classes in order to gain modularity.  So far I have a VMManager, a VHDManager, a VMRCManager and so on.  Reading the code now makes a lot more sense than before.

This is the part in which most of the work has been lately done, the Disks tab:

ZZ33FBC3C2

From here, you can pretty much do anything related with VHDs.  After modifying some ISOs,  I have also managed to completely automate the defragmentation-precompaction-compaction phase required to reduce the size of VHDs.  Now I just leave the process running and when I arrive the next day, my VHDs are like 50% smaller.

I had not touched C# in a while, and all I can say is "Wow".  C# rocks, it is very intuitive and creating efficient GUIs is a bliss.  One can only wish that there was a 2.0 framework to run under OS X.

I have also fixed the problem with OCX stats at runtime - actually it was a workaround, not a fix.  Here is a video I made of some of the features of the application, which include:

  • VHD Attachment
  • VHD Creation
  • VM Creation
  • VMRC in tabs for each of the machines
*sigh*...It has been impossible to embed the video here, here is the youtube link.

In case the resolution of the movie above is too small, the avi can also be downloaded.

For all things related to software migration, be sure to visit Artinsoft's website. For training in Visual Basic to C# migrations, Visual Basic to VB.Net, Virtualization, and 64-bit training check our training web page.

Problems Creating a VMRC ActiveX Instance at RunTime

9. April 2007 06:40 by Csaborio in General  //  Tags: ,   //   Comments (0)

During the Virtualization labs, which are freely available to anyone interested in Virtualization, the Artinsoft trainers have had a chance to teach the Virtual Server COM API and its uses.  One of the attendees showcases the application that they build on his blog. I think the application in its finished state is a great start to create something functional, but it is in no way something that can be used for management right out of the box.  The reason for this is simple: we wanted simple in order to reduce the learning curve of the COM API. 

I have started to work on my spare time on a new version of the Virtual Machine Configuration Assistant (VMCA) which will be version 2.0 due to major UI overhaul it has had.   One of the cool things I wanted to do, was the ability to open VMRC connections within the app in tabs (gotta love tabs in everything!).  So here is the interface I have so far (click on the image for larger view, as it has info on what I am trying to accomplish):

ZZ5B4D2238

Sounds easy, huh?  Well, that is what I thought.  I have in my application the reference to the VMRC ActiveX control, the image that you see above depicts a VMRC instance placed on the form in Design Time.

When the user selects the VMRC option, I have the following code:

vmrcControl = new AxVMRCClientControl();
vmrcControl.ServerAddress = "vs02";
vmrcControl.Size = new System.Drawing.Size(985, 675);
//Add a New Tab
this.tabPage1 = new TabPage();
tabPage1.Text = VMCA.VirtualInstances.getVMInstance().Name;
//Add the VMRC Control
tabPage1.Controls.Add(vmrcControl);
vmrcControl.Location = new System.Drawing.Point(0, 0);
this.tbcVMRC.TabPages.Add(tabPage1);
vmrcControl.UserName = "Administrator"

The line in red below is where all hell breaks loose:

ZZ735D6EE2

The problems seems to be that at design time, the VS Designer creates and configures a resource that is used to keep track of the ActiveX instance's state.  At runtime, this resource does not exists and that is the reason why the ActiveX is an invalid state.  Not being the ActiveX hacker that I would like to be, I am baffled on this problem.

Have you ever suffered with a problem such as the one above?  I have looked for help at various locations without any luck.  Although not critical, this feature is something that would definitely rock.  Help me solve this problem and I will send you a couple of pure quality Costa Rican coffee wherever you may be (if you are in Costa Rica, I'll send you beer instead ;)

I have posted a project which repros the problem:

http://amd.streamload.com/artinsoft/Links/5B75335893

In order to repro, just debug the app, and from the menus select Remote Control...if you can somehow make it through without the invalid OCX state exception, you are right on the money.

UPDATE: In order to run the project above, you *need* to have the VMRC ActiveX control installed on your machine.  The following page will guide you with the necessary steps to complete this process: https://www.microsoft.com/resources/virtuallabs/installactivex-technet.aspx

For all things related to software migration, be sure to visit Artinsoft's website.  For training in Visual Basic to C# migrations, Visual Basic to VB.Net,  Virtualization, and 64-bit training check our training web page.