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
| function OnCopyData(hWnd: HWND; wParam: WPARAM; lParam: LPARAM): LRESULT;
var
pcd: PCopyDataStruct;
TnCDS: PTrayNotifyCDS;
NID: NotifyIconData;
//...
begin
FillChar(NID, SizeOf(TNotifyIconData), 0); // pourquoi ici ? Et pourquoi avec SizeOf(TNotifyIconData) et non TNotifyIconData.SizeOf ?
Result := 1;
pcd := PCopyDataStruct(lParam);
if pcd^.dwData = 1 then begin // qui envoie ces messages en settant à 1 ?
TnCDS:=PTrayNotifyCDS(pcd.lpData); // que vaut pcd^.cbData ? en principe, taille de lpData, soit ici TNotifyIconData.SizeOf
NID:=TnCDS^.nicon_data;
if NID.cbSize >= TNotifyIconData.SizeOf then
case TnCDS^.notify_code of
NIM_ADD:
begin
Result := 1;
NewTrayIcon(NID);
end;
NIM_DELETE:
begin
Result := 1;
DeleteTrayIcon(NID);
end;
NIM_MODIFY:
begin
ModifyTrayIcon(NID);
Result := 1;
end;
end;
end;
end; |
Partager