有礼了。需不需要释放句炳?
Lin 2000-03-04 05:20:00 我在一线程中需要动态改变Application的Icon属性,代码如下:
procedure TfrmPlay.ThreadTimerTimer(Sender: TObject);
var icn: HICON;
begin
if MediaPlayer.PlayState = mpPlaying then
begin
with MediaPlayer do
if (CurrentPosition > 0) and (Duration > 0) then
Progress.Position := Min(StrToInt(Format('%2.0f', [CurrentPosition / Duration * 100])), 100);
Inc(IconIndex);
icn := Application.Icon.Handle;
Application.Icon.Handle := LoadIcon(hInstance, MAKEINTRESOURCE(IconIndex));
DestroyIcon(icn);
IconIndex := IconIndex mod 8;
end;
end;
问题是:我在释放图标句柄后,Application总有点闪烁,有时显示的是缺省的Windows Application图标。但如果不释放,会不会造成内存泄漏?
我该怎么半?