var WM_TASKRESTART : Cardinal; type tform1=class(Tform) private protected procedure WndProc(var Message: TMessage); override; public end;implementationprocedure Tform1.WndProc(var Message: TMessage); begin inherited; //Explorer重启时重建托盘 if Message.Msg = WM_TASKRESTART then begin ReCreateTray(Handle);// 重建托盘的函数 自己定义 end;end;initialization WM_TASKRESTART := RegisterWindowMessage('TaskbarCreated');