| 1044 | } |
| 1045 | |
| 1046 | HRESULT AddJumpListTaskInternal(IObjectCollection *poc, const TCHAR *pszName, const TCHAR *pszPath, |
| 1047 | const TCHAR *pszArguments, const TCHAR *pszIconPath, int iIcon) |
| 1048 | { |
| 1049 | if (poc == NULL || pszName == NULL || pszPath == NULL || pszArguments == NULL |
| 1050 | || pszIconPath == NULL) |
| 1051 | { |
| 1052 | return E_FAIL; |
| 1053 | } |
| 1054 | |
| 1055 | IShellLink *pShellLink = NULL; |
| 1056 | HRESULT hr; |
| 1057 | |
| 1058 | hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pShellLink)); |
| 1059 | |
| 1060 | if (SUCCEEDED(hr)) |
| 1061 | { |
| 1062 | pShellLink->SetPath(pszPath); |
| 1063 | pShellLink->SetArguments(pszArguments); |
| 1064 | pShellLink->SetIconLocation(pszIconPath, iIcon); |
| 1065 | |
| 1066 | IPropertyStore *pps = NULL; |
| 1067 | PROPVARIANT pv; |
| 1068 | |
| 1069 | hr = pShellLink->QueryInterface(IID_PPV_ARGS(&pps)); |
| 1070 | |
| 1071 | if (SUCCEEDED(hr)) |
| 1072 | { |
| 1073 | hr = InitPropVariantFromString(pszName, &pv); |
| 1074 | |
| 1075 | if (SUCCEEDED(hr)) |
| 1076 | { |
| 1077 | /* See: http://msdn.microsoft.com/en-us/library/bb787584(VS.85).aspx */ |
| 1078 | PROPERTYKEY keyTitle; |
| 1079 | keyTitle.pid = 2; |
| 1080 | hr = CLSIDFromString(L"{F29F85E0-4FF9-1068-AB91-08002B27B3D9}", &keyTitle.fmtid); |
| 1081 | |
| 1082 | if (SUCCEEDED(hr)) |
| 1083 | { |
| 1084 | pps->SetValue(keyTitle, pv); |
| 1085 | pps->Commit(); |
| 1086 | |
| 1087 | poc->AddObject(pShellLink); |
| 1088 | } |
| 1089 | |
| 1090 | PropVariantClear(&pv); |
| 1091 | } |
| 1092 | |
| 1093 | pps->Release(); |
| 1094 | } |
| 1095 | |
| 1096 | pShellLink->Release(); |
| 1097 | } |
| 1098 | |
| 1099 | return hr; |
| 1100 | } |
| 1101 | |
| 1102 | /* Returns a list of DLL's/IUnknown interfaces. Note that |
| 1103 | is up to the caller to free both the DLL's and objects |
no test coverage detected