自己加一个类,然后把OnTimer放到它里边,再把Timer1.Ontimer指过去<br>type<br>TCom = class(TComponent)<br> iOnTimer(Sender: TObject);<br>end;<br><br>procedure TimerSend(PortID: LongInt); stdcall; export;<br>var<br> MyTimer: TTimer;<br>begin<br> Mytimer.Create(MyTimer);<br> MyTimer.Interval:= 100;<br> MyTimer.Ontimer := iOnTimer;<br> MyTimer.Enabled:= true;<br><br>