Quantcast
Channel: VMware Communities : Popular Discussions - VIX API
Viewing all articles
Browse latest Browse all 34639

Cannot assign to IHost instance from IJob returned by Connect(). Using Microsoft Visual Basic 2005.

$
0
0

 

Hello,

 

 

Following is the code:

 

 

Dim m_vmVixLib As VixCOM.VixLib

 

 

Dim m_vmVixJob As VixCOM.IJob

 

 

Dim m_vmVixHost As VixCOM.IHost

 

 

Dim m_vmVixVM As VixCOM.IVM

 

 

Dim m_vmVixResult As Object

 

 

Dim propertyIDS() As Integer = {VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE}

 

 

 

 

 

m_vmVixJob = m_vmVixLib.Connect(1, VixCOM.Constants.VIX_SERVICEPROVIDER_VMWARE_SERVER, strGSXHostIPAddress, 0, strUserID, strPassword, 0, Nothing, Nothing)

 

 

m_vmVixResult = Nothing

 

 

err = m_vmVixJob.Wait(propertyIDS, m_vmVixResult) -


err is 0 indicating the connect passed.

 

 

 

 

 

m_vmVixHost = CType(m_vmVixResult, VixCOM.IHost) -


I have tried using m_vmVixHost = m_VMVixResult(0). But it doesn't work. Gives a compile error. I am forced to cast this to vixCom.Host type.

 

 

However, when i run the program, i get a " A first chance exception of type 'System.InvalidCastException' occurred in VMSpinner.exe " error with the above line.

 

 

Can anyone help me with the above error? Thanks much in advance.

 

 

 

 

 

 

 

 


Viewing all articles
Browse latest Browse all 34639

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>