Bonjour

J'essaye en ce moment de personnaliser la JumpList d'une application. Pour ceux qui ne savent pas, la JumpList est une nouveauté de Seven :


(voici celle d'internet Explorer)

Il est possible de personnaliser cette liste, grâce à l'API ICustomDestinationList. L'ennui, c'est que ICustomDestinationList est une interface, et je ne sais pas comment me servir d'une interface lorsqu'elle est incluse dans une API.

J'ai déja essayé de traduire cette interface en Delphi :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
  ICustomDestinationList = interface
  ['{8313EC77-DC86-462E-8BCB-1B5740DE97C2}']
    function AbortList : HRESULT;
    function AddUserTasks (const poa : PIObjectArray) : HRESULT;
    function AppendCategory (const pszCategory : PWideChar; const poa : PIObjectArray) : HRESULT;
    function AppendKnownCategory (const category : Integer) : HRESULT;
    function BeginList(out pcMinSlots : PCardinal; const riid : TGUID; out ppv : Pointer) : HRESULT;
    function CommitList : HRESULT;
    function DeleteList (const pszAppID : PWideChar) : HRESULT;
    function GetRemovedDestinations (const riid : TGUID; out ppv : Pointer) : HRESULT;
    function SetAppID (const pszAppID : PWideChar) : HRESULT;
  end;
avec PIObjectArray qui est un pointeur sur IObjectArray que j'ai aussi traduit :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
  IObjectArray = interface
  ['{32E94EAA-B066-4F97-B0C7-6C631B4D250C}']
    function GetAt(const uiIndex : Cardinal; const riid : TGUID; out ppv : Pointer) : HRESULT;
    function GetCount(out pcObjects : PCardinal) : HRESULT;
  end;
 
  PIObjectArray = ^IObjectArray;
et, c'est la que je ne sais plus quoi faire ... Je ne sais pas comment me servir de tout ca pour pouvoir personnaliser cette JumpList ...

J'ai bien trouvé cet exemple, mais ca ne m'avance pas, je n'arrive pas a m'en servir ...
Code c++ : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
  void CreateJumpList()   
  {       
      ICustomDestinationList *pcdl;   
      HRESULT hr = CoCreateInstance   
                     (CLSID_DestinationList,    
                      NULL, CLSCTX_INPROC_SERVER,    
     IID_PPV_ARGS(&pcdl));   
 
      if (SUCCEEDED(hr))  
      {  
          hr = pcdl->SetAppID(c_szAppID);  
          if (SUCCEEDED(hr))  
          {  
              UINT uMaxSlots;  
              IObjectArray *poaRemoved;  
              hr = pcdl->BeginList  
                  (&uMaxSlots, IID_PPV_ARGS(&poaRemoved));  
              if (SUCCEEDED(hr))  
              {  
                  hr = _AddCategoryToList(pcdl, poaRemoved);  
                  if (SUCCEEDED(hr))  
                  {  
                      pcdl->CommitList();  
                  }  
                  poaRemoved->Release(); 
              }  
          }  
      }  
  }// This is the helper function that actually 
//appends the items to a collection object HRESULT  
 
_AddCategoryToList(ICustomDestinationList *pcdl,
                       IObjectArray *poaRemoved)
{
    IObjectCollection *poc;
    HRESULT hr = CoCreateInstance(CLSID_EnumerableObjectCollection, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&poc));
    if (SUCCEEDED(hr))
    {
        for (UINT i = 0; i < ARRAYSIZE(c_rgpszFiles); i++)
        {
            IShellItem *psi;
            if (SUCCEEDED(SHCreateItemInKnownFolder(FOLDERID_Documents, KF_FLAG_DEFAULT, c_rgpszFiles[i], IID_PPV_ARGS(&psi))))
            {
                if(!_IsItemInArray(psi, poaRemoved))
                {
                    poc->AddObject(psi);
                }
                 psi->Release();
            }
        }
         IObjectArray *poa;
        hr = poc->QueryInterface(IID_PPV_ARGS(&poa));
        if (SUCCEEDED(hr))
        {
            pcdl->AppendCategory(L"Custom category", poa);
            poa->Release();
        }
        poc->Release();
    }    return hr;
}

Donc voila, si quelqu'un peut me donner un coup de pouce pour continuer, merci d'avance !

Mick605