# include & lt; Stdio. H>
# include & lt; Stdlib. H>
# include "the vix. H"
# pragma comment (lib, "the vix. Lib")
# define USE_WORKSTATION
# ifdef USE_WORKSTATION
# define CONNTYPE VIX_SERVICEPROVIDER_VMWARE_WORKSTATION
# define the HOSTNAME ""
# define HOSTPORT 0
# define the USERNAME ""
# define the PASSWORD ", "
# define VMPOWEROPTIONS VIX_VMPOWEROP_LAUNCH_GUI
Int main ()
{
VixError err;
Char * vmxPath="D: \ \ Windows xp \ \ Windows xp Professional. VMX";
VixHandle hostHandle=VIX_INVALID_HANDLE;
VixHandle jobHandle=VIX_INVALID_HANDLE;
VixHandle vmHandle=VIX_INVALID_HANDLE;
JobHandle=VixHost_Connect (VIX_API_VERSION,
CONNTYPE,
The HOSTNAME,//* the HOSTNAME,
HOSTPORT,//HOSTPORT,
The USERNAME,//* USERNAME,
PASSWORD,//* PASSWORD,
0,//options,
VIX_INVALID_HANDLE,//propertyListHandle,
NULL,//* callbackProc,
NULL);//* clientData);
Err=VixJob_Wait (jobHandle,
VIX_PROPERTY_JOB_RESULT_HANDLE,
& HostHandle,
VIX_PROPERTY_NONE);
If (VIX_FAILED (err)) {
Goto abort.
}
Vix_ReleaseHandle (jobHandle);
JobHandle=VIX_INVALID_HANDLE;
JobHandle=VixVM_Open (hostHandle,
VmxPath,
NULL,//VixEventProc * callbackProc,
NULL);//void * clientData);
Err=VixJob_Wait (jobHandle,
VIX_PROPERTY_JOB_RESULT_HANDLE,
& VmHandle,
VIX_PROPERTY_NONE);
If (VIX_FAILED (err)) {
Goto abort.
}
Vix_ReleaseHandle (jobHandle);
JobHandle=VixVM_PowerOn (vmHandle,
VMPOWEROPTIONS,
VIX_INVALID_HANDLE,
NULL,//* callbackProc,
NULL);//* clientData);
Err=VixJob_Wait (jobHandle VIX_PROPERTY_NONE);
If (VIX_FAILED (err)) {
Goto abort.
}
Vix_ReleaseHandle (jobHandle);
JobHandle=VixVM_PowerOff (vmHandle,
VIX_VMPOWEROP_NORMAL,
NULL,//* callbackProc,
NULL);//* clientData);
Err=VixJob_Wait (jobHandle VIX_PROPERTY_NONE);
If (VIX_FAILED (err)) {
Goto abort.
}
Abort:
Vix_ReleaseHandle (jobHandle);
Vix_ReleaseHandle (vmHandle);
VixHost_Disconnect (hostHandle);
return 0;
}
Error
The VM \ the main c | | 5 warning: ignoring # pragma comment |
VM \ main 8 c | | error: unterminated # ifdef |
| |===Build finished: 1 errors, warnings===|
CodePudding user response:
Online, etc.,,,,,,,,,,,,,,,,,,,,,,,