本文整理汇总了C++中ITask::GetParameters方法的典型用法代码示例。如果您正苦于以下问题:C++ ITask::GetParameters方法的具体用法?C++ ITask::GetParameters怎么用?C++ ITask::GetParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITask
的用法示例。
在下文中一共展示了ITask::GetParameters方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetTaskDetails2
void GetTaskDetails2(wchar_t* buf, int bufSize, ITaskScheduler *pITS, LPCWSTR lpcwszTaskName)
{
HRESULT hr = S_OK;
ITask *pITask = 0;
wchar_t tmp[500];
hr = pITS->Activate(lpcwszTaskName, IID_ITask, (IUnknown**) &pITask);
if (FAILED(hr))
{
_snwprintf(tmp, sizeof(tmp), L"Failed calling ITaskScheduler::Activate; error = 0x%x\n",hr);
wcsncat(buf, tmp, bufSize);
return;
}
LPWSTR lpwszApplicationName;
hr = pITask->GetApplicationName(&lpwszApplicationName);
if (FAILED(hr))
{
_snwprintf(tmp, sizeof(tmp), L"Failed calling ITask::GetApplicationName error = 0x%x\n", hr);
wcsncat(buf, tmp, bufSize);
lpwszApplicationName = 0;
}
LPWSTR lpwszParameters;
hr = pITask->GetParameters(&lpwszParameters);
if (FAILED(hr))
{
_snwprintf(tmp, sizeof(tmp), L"Failed calling ITask::GetApplicationName error = 0x%x\n", hr);
wcsncat(buf, tmp, bufSize);
lpwszParameters = 0;
}
pITask->Release();
if(lpwszApplicationName){
_snwprintf(tmp, sizeof(tmp), L"\t-Exe: %s\n", lpwszApplicationName);
wcsncat(buf, tmp, bufSize);
CoTaskMemFree(lpwszApplicationName);
}
if(lpwszParameters){
_snwprintf(tmp, sizeof(tmp), L"\t-Params: %s\n", lpwszParameters);
wcsncat(buf, tmp, bufSize);
CoTaskMemFree(lpwszParameters);
}
}
示例2: GetTaskDetails
void GetTaskDetails(FILE* f, ITaskScheduler *pITS, LPCWSTR lpcwszTaskName)
{
HRESULT hr = S_OK;
ITask *pITask = 0;
hr = pITS->Activate(lpcwszTaskName, IID_ITask, (IUnknown**) &pITask);
if (FAILED(hr))
{
fwprintf(f, L"Failed calling ITaskScheduler::Activate; error = 0x%x\n",hr);
return;
}
LPWSTR lpwszApplicationName;
hr = pITask->GetApplicationName(&lpwszApplicationName);
if (FAILED(hr))
{
fwprintf(f, L"Failed calling ITask::GetApplicationName error = 0x%x\n", hr);
lpwszApplicationName = 0;
}
LPWSTR lpwszParameters;
hr = pITask->GetParameters(&lpwszParameters);
if (FAILED(hr))
{
fwprintf(f, L"Failed calling ITask::GetApplicationName error = 0x%x\n", hr);
lpwszParameters = 0;
}
pITask->Release();
if(lpwszApplicationName){
fwprintf(f, L"\t-Exe: %s\n", lpwszApplicationName);
CoTaskMemFree(lpwszApplicationName);
}
if(lpwszParameters){
fwprintf(f, L"\t-Params: %s\n", lpwszParameters);
CoTaskMemFree(lpwszParameters);
}
}
示例3: GetTaskInfo
//---------------------------------------------------------------------------
int TTaskScheduler::GetTaskInfo(wstring taskName, TTaskParams& taskParams){
ITask *pITask = Activate(taskName);
if(pITask == NULL){
return 0;
}
LPWSTR ppwszAccountName;
LPWSTR ppwszComment;
LPWSTR ppwszCreator;
LPWSTR lpwszApplicationName;
LPWSTR lpwszParameters;
LPWSTR lpwszWorkDir;
DWORD pdwExitCode;
DWORD pdwRunTime;
DWORD pdwPriority;
WORD pwIdleMinutes;
WORD pwDeadlineMinutes;
SYSTEMTIME pstLastRun;
SYSTEMTIME pstNextRun;
HRESULT phrStatus;
HRESULT hr = pITask->GetAccountInformation(&ppwszAccountName);
if (FAILED(hr)){
sprintf(lastError, "Failed to retreive task info, error = 0x%x\n",hr);
taskParams.accountName = L"";
}else{
taskParams.accountName = ppwszAccountName;
CoTaskMemFree(ppwszAccountName);
}
hr = pITask->GetApplicationName(&lpwszApplicationName);
if (FAILED(hr)){
sprintf(lastError, "Failed to retreive task info, error = 0x%x\n",hr);
}else{
taskParams.appName = lpwszApplicationName;
CoTaskMemFree(lpwszApplicationName);
}
hr = pITask->GetComment(&ppwszComment);
if (FAILED(hr)){
sprintf(lastError, "Failed to retreive task info, error = 0x%x\n",hr);
}else{
taskParams.comments = ppwszComment;
CoTaskMemFree(ppwszComment);
}
hr = pITask->GetCreator(&ppwszCreator);
if (FAILED(hr)){
sprintf(lastError, "Failed to retreive task info, error = 0x%x\n",hr);
}else{
taskParams.creator = ppwszCreator;
CoTaskMemFree(ppwszCreator);
}
hr = pITask->GetExitCode(&pdwExitCode);
if (FAILED(hr)){
sprintf(lastError, "Failed to retreive task info, error = 0x%x\n",hr);
}else{
taskParams.exitCode = pdwExitCode;
}
hr = pITask->GetIdleWait(&pwIdleMinutes, &pwDeadlineMinutes);
if (FAILED(hr)){
sprintf(lastError, "Failed to retreive task info, error = 0x%x\n",hr);
}else{
taskParams.deadlineMinutes = pwDeadlineMinutes;
taskParams.idleMinutes = pwIdleMinutes;
}
hr = pITask->GetMaxRunTime(&pdwRunTime);
if (FAILED(hr)){
sprintf(lastError, "Failed to retreive task info, error = 0x%x\n",hr);
}else{
taskParams.maxRuntime = pdwRunTime;
}
hr = pITask->GetMostRecentRunTime(&pstLastRun);
if (FAILED(hr)){
sprintf(lastError, "Failed to retreive task info, error = 0x%x\n",hr);
}else{
taskParams.lastRun = pstLastRun;
}
hr = pITask->GetNextRunTime(&pstNextRun);
if (FAILED(hr)){
sprintf(lastError, "Failed to retreive task info, error = 0x%x\n",hr);
}else{
taskParams.nextRun = pstNextRun;
}
hr = pITask->GetParameters(&lpwszParameters);
if (FAILED(hr)){
sprintf(lastError, "Failed to retreive task info, error = 0x%x\n",hr);
}else{
//.........这里部分代码省略.........