The following example illustrates how to obtain a handle of type PHT_SYSTEM_STATISTICS.
PRL_RESULT err = PRL_ERR_UNINITIALIZED; PRL_RESULT rc = PRL_ERR_UNINITIALIZED; PRL_HANDLE hJob = PRL_INVALID_HANDLE; PRL_HANDLE hJobResult = PRL_INVALID_HANDLE; PRL_HANDLE hServer = PRL_INVALID_HANDLE; // Initialize API library. err = PrlApi_Init(PARALLELS_API_VER); if (PRL_FAILED(err)) { // Error handling goes here... return -1; } // Create server handle. err = PrlSrv_Create(&hServer); // if (err != PRL_ERR_SUCCESS), process the error here. hJob = PrlSrv_Login( hServer, // Server handle "10.30.21.243", // Server IP address "jdoe", // User "secret", // Password 0, // Previous session ID 0, // Port number 0, // Timeout PSL_LOW_SECURITY); // Security // Wait for the job to complete. err = PrlJob_Wait(hJob, 1000); // if (err != PRL_ERR_SUCCESS), process the error here. // Get job return code. err = PrlJob_GetRetCode(hJob, &rc); // if (err != PRL_ERR_SUCCESS), process the error here. // if (rc != PRL_ERR_SUCCESS), process the error here. // Free job handle. PrlHandle_Free(hJob); // Get statistics. hJob = PrlSrv_GetStatistics(hServer); err = PrlJob_Wait(hJob, 10000); // if (err != PRL_ERR_SUCCESS), process the error here. err = PrlJob_GetRetCode(hJob, &rc); // if (err != PRL_ERR_SUCCESS), process the error here. // if (rc != PRL_ERR_SUCCESS), process the error here. err = PrlJob_GetResult(hJob, &hJobResult); PrlHandle_Free(hJob); // Get the PHT_SYSTEM_STATISTICS handle. PRL_HANDLE hHandle = PRL_INVALID_HANDLE; err = PrlResult_GetParam(hJobResult, &hHandle); // if (err != PRL_ERR_SUCCESS), process the error here. PrlHandle_Free(hJobResult);