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


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

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


在下文中一共展示了ITask::SetComment方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetTaskProperties

//---------------------------------------------------------------------------
void TTaskScheduler::SetTaskProperties(wstring taskName, TTaskParams taskParams){
    ITask *pITask = Activate(taskName);

    if(pITask == NULL){
        return;
    }


    if(taskParams.accountName.length() > 0 && taskParams.accountPwd.length() > 0){
        pITask->SetAccountInformation(taskParams.accountName.data(),
                                      taskParams.accountPwd.data());
    }

    if(taskParams.appName.length() > 0){
        pITask->SetApplicationName(taskParams.appName.data());
    }

    if(taskParams.appParameters.length() > 0){
        pITask->SetParameters(taskParams.accountName.data());
    }

    if(taskParams.comments.length() > 0){
        pITask->SetComment(taskParams.comments.data());
    }

    if(taskParams.workingDirectory.length() > 0){
        pITask->SetWorkingDirectory(taskParams.workingDirectory.data());
    }

    Save(pITask);
    pITask->Release();

}
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:34,代码来源:TTaskScheduler.cpp

示例2: setScheduleTask

/**
 * Set a Task into task scheduler. It takes values to insert from Schedule form.
 * If task already exists, it is updated with passed parameters.
 * Starting time is always set to current time (task starts now).
 *
 * @param frequency : NEVER or EVERY_DAY
 * @param dayNum    : repeate the task every 'dayNum'
 * @param minNum    : repeate the task every 'minNum'
 * @return            0 if no errors.
 */
int setScheduleTask (const char* frequency, const int dayNum, const int minNum) {

    HRESULT hr = S_OK;
    bool newTask = false;
    ITaskScheduler* pITS = NULL;
    ITask*          pITask;
    IPersistFile*   pIPersistFile;
    wstring taskName, user;

    // Init COM library & create instance for Task scheduler.
    if ((pITS = initScheduleInstance()) == NULL) {
        goto error;
    }

    // Task is associated with current user
    if (getScheduledTaskName(taskName)) {
        goto error;
    }

    // We need the extended username "MACHINE\USER" to ensure that
    // the job can run also for users logged in with another domain (ref bug #307010).
    if (getWindowsUserEx(user)) {
        goto error;
    }

    //
    // Try to open EXISTING TASK.
    //
    LOG.debug("Try opening the Windows task: \"%ls\"", taskName.c_str());
    hr = pITS->Activate(taskName.c_str(),
                        IID_ITask,
                        (IUnknown**) &pITask);
    
    if (FAILED(hr)) {
        if (hr == E_OBJECT_NOT_FOUND) {
            //
            // NEW TASK -> create it.
            //
            LOG.debug(DBG_SCHED_TASK_NOT_FOUND);
            newTask = true;

            WCHAR path[512];
            OutlookConfig* config = OutlookConfig::getInstance();
            // Get current working dir (from config)
            const char* t = config->getWorkingDir();
            WCHAR* wt = toWideChar(t);
            wsprintf(path, TEXT("\"%s\\%s\""), wt, TEXT(PROGRAM_NAME_EXE));
            delete [] wt;  wt = NULL;

            hr = pITS->NewWorkItem(taskName.c_str(),       // Name of task
                                   CLSID_CTask,            // Class identifier
                                   IID_ITask,              // Interface identifier
                                   (IUnknown**)&pITask);   // Address of task interface
            if (FAILED(hr)) {
                char* msg = readSystemErrorMsg(hr);
                setErrorF(getLastErrorCode(), ERR_SCHED_NEWWORKITEM, hr, msg);
                delete [] msg;
                pITS->Release();
                goto error;
            }

            // Set path and comment on new task.
            pITask->SetApplicationName(path);
            pITask->SetComment(SCHED_COMMENT);
        }
        else {
            char* msg = readSystemErrorMsg(hr);
            setErrorF(getLastErrorCode(), ERR_SCHED_ACTIVATE, hr, msg);
            delete [] msg;
            pITS->Release();
            goto error;
        }
    }
    pITS->Release();


    //
    // Set task params: flags, account info, parameters
    if (strcmp(NEVER, frequency) == 0) {
        pITask->SetFlags(TASK_FLAG_DISABLED);
    } 
    else {
        pITask->SetAccountInformation(user.c_str(), NULL);
        pITask->SetFlags(TASK_FLAG_INTERACTIVE | TASK_FLAG_RUN_ONLY_IF_LOGGED_ON);
    }

    // ...so we have "OutlookPlugin.exe schedule"    
    pITask->SetParameters(SCHED_PARAM);


//.........这里部分代码省略.........
开发者ID:PaulCarrick,项目名称:funambol-outlook-client,代码行数:101,代码来源:OutlookScheduler.cpp

示例3: SaveTask


//.........这里部分代码省略.........
            {
            TRACE1("CScheduledTask::SaveTask() - failed to set parameters. Return = 0x%08X\n",
                   (DWORD) hr );
            return hr;
            }
        }        


    // Set the starting directory.

    if ( m_sStartingDir.GetLength() > 0 )
        {
        hr = pITask->SetWorkingDirectory ( T2COLE( (LPCTSTR) m_sStartingDir ));

        if ( FAILED(hr) )
            {
            TRACE1("CScheduledTask::SaveTask() - failed to set starting directory. Return = 0x%08X\n",
                   (DWORD) hr );
            return hr;
            }
        }


	TCHAR infoBuf[32767];
	DWORD bufCharCount = 32767;

	GetUserNameEx(NameSamCompatible, infoBuf, &bufCharCount);
	hr = pITask->SetAccountInformation((LPCWSTR)infoBuf, L"");

    // Set the job comment.

    if ( m_sComment.GetLength() > 0 )
        {
        hr = pITask->SetComment ( T2COLE( (LPCTSTR) m_sComment ));

        if ( FAILED (hr) )
            {
            TRACE1("CScheduledTask::SaveTask() - failed to set task comment. Return = 0x%08X\n",
                   (DWORD) hr );
            return hr;
            }
        }

    //TCHAR pszName[CREDUI_MAX_USERNAME_LENGTH] = "";
    //TCHAR pszPwd[CREDUI_MAX_PASSWORD_LENGTH] = "";

  ///////////////////////////////////////////////////////////////////
  // Call ITask::SetAccountInformation to specify the account name
  // and the account password for Test Task.
  ///////////////////////////////////////////////////////////////////
  //hr = pITask->SetAccountInformation((LPCWSTR)pszName, 
  //          (LPCWSTR)pszPwd);

  //SecureZeroMemory(pszName, sizeof(pszName));
  //SecureZeroMemory(pszPwd, sizeof(pszPwd));
  


    // Set the flags on the task object
    
    // The two flags below are the default for events created via the task 
    // scheduler UI.
    // Note that I _don't_ set TASK_FLAG_DELETE_WHEN_DONE.  Setting this flag
    // is bad if you have the "Notify me of missed tasks" option on in the
    // scheduler.  If this flag is set and the event is missed, the scheduler
    // nukes the event without notifying you .  How mean.
开发者ID:DjPasco,项目名称:Mag,代码行数:67,代码来源:ScheduledTask.cpp

示例4: SaveTask


//.........这里部分代码省略.........

    // ustawiamy folder startowy dla aplikacji
    if ( m_sStartingDir.GetLength() > 0 )
        {
        hr = pITask->SetWorkingDirectory ( T2COLE( (LPCTSTR) m_sStartingDir ));

        if ( FAILED(hr) )
            {
            TRACE1("CTask::SaveTask() - failed to set starting directory. Return = 0x%08X\n",
                   (DWORD) hr );
            return hr;
            }
        }


    // ustawiamy nazwe uzytkownika i haslo, jesli jestesmy na NT
    if ( m_bNT )
        {
        hr = pITask->SetAccountInformation ( T2COLE( (LPCTSTR) m_sAccount),
                                             T2COLE( (LPCTSTR) m_sPassword) );

        if ( FAILED(hr) )
            {
            TRACE1("CTask::SaveTask() - failed to set account info.  Return = 0x%08X\n",
                   (DWORD) hr );
            return hr;
            }
        }


    // ustawiamy komentarz do zadania
    if ( m_sComment.GetLength() > 0 )
        {
        hr = pITask->SetComment ( T2COLE( (LPCTSTR) m_sComment ));

        if ( FAILED (hr) )
            {
            TRACE1("CTask::SaveTask() - failed to set task comment. Return = 0x%08X\n",
                   (DWORD) hr );
            return hr;
            }
        }


    // ustawiamy flagi
    //zapraszam do eksperymentow z flaga TASK_FLAG_DELETE_WHEN_DONE...
    dwTaskFlags = TASK_FLAG_DONT_START_IF_ON_BATTERIES |
                  TASK_FLAG_KILL_IF_GOING_ON_BATTERIES;

    // na NT ustawimy flage interactive
    if ( !( GetVersion() & 0x80000000 ) )
        {
        dwTaskFlags |= TASK_FLAG_INTERACTIVE;
        }

    hr = pITask->SetFlags ( dwTaskFlags );

    if ( FAILED (hr) )
        {
        TRACE1("CTask::SaveTask() - failed to set task flags. Return = 0x%08X\n",
               (DWORD) hr );
        return hr;
        }


    // teraz tworzymy Trigger, czyli wyzwalacz
开发者ID:tuku1185,项目名称:taskscheduler,代码行数:67,代码来源:CTask.cpp


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