Tasks are items that sit in the tasks panel in the WMC and appear as text commands that can be clicked. They can be optionally grouped into sections.

First, insert a group task group under the TASKLIST root with NavInsertItem.
NAVSETITEM taskRootData; NavGetItem(L"TASKLIST", &taskRootData); // Get the task root to put our group under NAVSETITEM taskGroupData; memset(&taskGroupData, 0, sizeof(taskGroupData)); taskGroupData.flags = NI_FLAG_CONTAINER; // Signals it's a group that will hold tasks taskGroupData.strLabel = L"Ad Blocker"; taskGroupData.strDescription = L"Tasks for the Ad Blocker component"; NavInsertItem(taskRootData.hItem, L"AdBlockerTaskGroup", &taskGroupData); // Error handling removed for brevity NavHandle taskGroup = taskGroupData.hItem; |
As with all navigation items, the label passed to NavInsertItem is a free form text field that has to be unique within its parent.
Once the group is inserted, add tasks beneath it in a similar manner.
NAVSETITEM settingsTaskData;
memset(&settingsTaskData, 0, sizeof(settingsTaskData));
settingsTaskData.flags = 0;
settingsTaskData.EventMask = NI_EVENT_MOUSE_LCLICK; // We want to know when it's clicked
settingsTaskData.strLabel = L"Settings";
settingsTaskData.strDescription = "Configure the Ad Blocker component";
settingsTaskData.strAlias = L"{MyCompanyAdBlockerSettingsTask}"; // Our custom alias. Optional. Aliases are global so need to be unique
settingsTaskData.lParam = 0; // Any context data you wish to pass to the notification interface when clicked
settingsTaskData.pInterface = ¬ificationInterface;
NavInsertItem(taskGroup, L"SettingsTask", &settingsTaskData);
NavHandle settingsTask = settingsTaskData.hItem;
|