2011-07-05 51 views

回答

0

這裏是代碼片段如何設置運行級別。

IPrincipal *pPrincipal = NULL; 
hr = pTask->get_Principal(&pPrincipal); 
if (FAILED(hr)) 
    { 
     printf("\nCannot get principal pointer: %x", hr); 
     pRootFolder->Release(); 
     pTask->Release(); 
     CoUninitialize(); 
     return false; 
    } 
// Set up principal run level to the highest one 
hr = pPrincipal->put_RunLevel(TASK_RUNLEVEL_HIGHEST); 
pPrincipal->Release(); 
if (FAILED(hr)) 
{ 
    printf("\nCannot put principal info: %x", hr); 
    pRootFolder->Release(); 
    pTask->Release(); 
    CoUninitialize(); 
    return false; 
}