| 979 | } |
| 980 | |
| 981 | HRESULT AddJumpListTasks(const std::list<JumpListTaskInformation> &taskList) |
| 982 | { |
| 983 | if (taskList.empty()) |
| 984 | { |
| 985 | return E_FAIL; |
| 986 | } |
| 987 | |
| 988 | ICustomDestinationList *pCustomDestinationList = NULL; |
| 989 | HRESULT hr; |
| 990 | |
| 991 | hr = CoCreateInstance( |
| 992 | CLSID_DestinationList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pCustomDestinationList)); |
| 993 | |
| 994 | if (SUCCEEDED(hr)) |
| 995 | { |
| 996 | IObjectArray *poa = NULL; |
| 997 | UINT uMinSlots; |
| 998 | |
| 999 | hr = pCustomDestinationList->BeginList(&uMinSlots, IID_PPV_ARGS(&poa)); |
| 1000 | |
| 1001 | if (SUCCEEDED(hr)) |
| 1002 | { |
| 1003 | poa->Release(); |
| 1004 | |
| 1005 | IObjectCollection *poc = NULL; |
| 1006 | |
| 1007 | hr = CoCreateInstance( |
| 1008 | CLSID_EnumerableObjectCollection, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&poc)); |
| 1009 | |
| 1010 | if (SUCCEEDED(hr)) |
| 1011 | { |
| 1012 | AddJumpListTasksInternal(poc, taskList); |
| 1013 | |
| 1014 | hr = poc->QueryInterface(IID_PPV_ARGS(&poa)); |
| 1015 | |
| 1016 | if (SUCCEEDED(hr)) |
| 1017 | { |
| 1018 | pCustomDestinationList->AddUserTasks(poa); |
| 1019 | pCustomDestinationList->CommitList(); |
| 1020 | |
| 1021 | poa->Release(); |
| 1022 | } |
| 1023 | |
| 1024 | poc->Release(); |
| 1025 | } |
| 1026 | } |
| 1027 | |
| 1028 | pCustomDestinationList->Release(); |
| 1029 | } |
| 1030 | |
| 1031 | return hr; |
| 1032 | } |
| 1033 | |
| 1034 | HRESULT AddJumpListTasksInternal( |
| 1035 | IObjectCollection *poc, const std::list<JumpListTaskInformation> &taskList) |
no test coverage detected