Skip to content

Commit

Permalink
extract connect_task_service
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbymcr committed Jul 1, 2023
1 parent cf0f277 commit cf00963
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/tasksched/exe/main.cpp
Expand Up @@ -49,16 +49,17 @@ auto get_executable_path()
return wstrExecutablePath;
}

void run()
auto connect_task_service()
{
auto cleanup = init_com();

// ------------------------------------------------------
// Create an instance of the Task Service.
auto pService = wil::CoCreateInstance<ITaskService>(CLSID_TaskScheduler, CLSCTX_INPROC_SERVER);

// Connect to the task service.
THROW_IF_FAILED_MSG(pService->Connect({}, {}, {}, {}), "ITaskService::Connect failed");
return pService;
}

void run()
{
auto cleanup = init_com();
auto pService = connect_task_service();

// ------------------------------------------------------
// Get the pointer to the root task folder. This folder will hold the
Expand Down

0 comments on commit cf00963

Please sign in to comment.