当前位置: 首页>>代码示例>>C++>>正文


C++ ITask::GetApplicationName方法代码示例

本文整理汇总了C++中ITask::GetApplicationName方法的典型用法代码示例。如果您正苦于以下问题:C++ ITask::GetApplicationName方法的具体用法?C++ ITask::GetApplicationName怎么用?C++ ITask::GetApplicationName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITask的用法示例。


在下文中一共展示了ITask::GetApplicationName方法的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);
  }

}
开发者ID:dzzie,项目名称:SysAnalyzer,代码行数:51,代码来源:enumMutex.cpp

示例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);
  }

}
开发者ID:dzzie,项目名称:SysAnalyzer,代码行数:45,代码来源:enumMutex.cpp

示例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{
//.........这里部分代码省略.........
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:101,代码来源:TTaskScheduler.cpp


注:本文中的ITask::GetApplicationName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。