Salut à tous !

J'aimerais mettre en place une synchronisation sur les modifications du presse-papiers entre différents threads.
La création de la fenêtre et l'ajout du listener ne semblent pas poser de problème, mais je ne reçois rien...

Code : 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
constructor TClipboardSync.Create(aSync: TEvent);
begin
  inherited Create;
 
  Sync := aSync;
  Sync.ResetEvent;
end;
 
procedure TClipboardSync.Execute;
var
  Msg      :TMsg;
  Wnd      :hWnd;
  NextWnd  :hWnd;
  WndClass :TWndClass;
 
begin
  try
    //Création de la fenêtre
    ZeroMemory(@WndClass, SizeOf(WndClass));
    WndClass.lpfnWndProc   := @DefWindowProc;
    WndClass.hInstance     := hInstance;
    WndClass.lpszClassName := 'TIClipboardSync';
 
    if Windows.RegisterClass(WndClass) <> 0 then
    try
      Wnd := CreateWindow(WndClass.lpszClassName, nil, WS_POPUP, 0, 0, 0, 0, 0, 0, HInstance, nil);
 
      if Wnd <> 0 then
      try
        //Mise en place du Listener en fonction de l'OS
        if GetWindowsVersion < wvVista
        then NextWnd := SetClipboardViewer(Wnd)
        else if not AddClipboardFormatListener(Wnd) then Exit;
 
        //Message loop
        while not Terminated do
        begin
          if PeekMessage(Msg, 0, 0, 0, PM_REMOVE) then
            with Msg do
              case Message of
                // XP
                WM_CHANGECBCHAIN:   begin
                                      if WParam = NextWnd
                                      then NextWnd := LParam
                                      else if NextWnd <> 0
                                           then SendMessage(NextWnd, Message, WParam, LParam);
                                    end;
 
                WM_DRAWCLIPBOARD:   begin
                                      if NextWnd <> 0 then
                                        SendMessage(NextWnd, Message, WParam, LParam);
 
                                      Terminate;
                                    end;
 
                // Vista+
                WM_CLIPBOARDUPDATE: Terminate;
 
                //Autres...
                else                begin
                                      TranslateMessage(Msg);
                                      DispatchMessage(Msg);
                                    end;
              end;
 
          Sleep(10);
        end;
 
      finally
        if GetWindowsVersion < wvVista then
          ChangeClipboardChain(Wnd, NextWnd);
 
        DestroyWindow(Wnd);
      end;
 
    finally
      Windows.UnregisterClass(WndClass.lpszClassName, HInstance);
    end;
 
  finally
    Sync.SetEvent;
  end;
end;
Si vous aviez une piste !
Merci.