你看一下下面的代码,其实就是使用Shell_NotifyIcon进行的。<br><br>function TCoolTrayIcon.ShowBalloonHint(Title: String; Text: String;<br> IconType: TBalloonHintIcon; TimeoutSecs: TBalloonHintTimeOut): Boolean;<br>// Show balloon hint. Return false if error.<br>const<br> aBalloonIconTypes: array[TBalloonHintIcon] of Byte =<br> (_NIIF_NONE, _NIIF_INFO, _NIIF_WARNING, _NIIF_ERROR);<br>begin<br> // Remove old balloon hint<br> HideBalloonHint;<br> // Display new balloon hint<br> with IconData do<br> begin<br> uFlags := uFlags or _NIF_INFO;<br> StrLCopy(szInfo, PChar(Text), SizeOf(szInfo)-1);<br> StrLCopy(szInfoTitle, PChar(Title), SizeOf(szInfoTitle)-1);<br> TimeoutOrVersion.uTimeout := TimeoutSecs * 1000;<br> dwInfoFlags := aBalloonIconTypes[IconType];<br> end;<br> Result := ModifyIcon;<br> { Remove _NIF_INFO before next call to ModifyIcon (or the balloon hint<br> will redisplay itself) }<br> with IconData do<br> uFlags := NIF_ICON + NIF_MESSAGE + NIF_TIP;<br>end;<br><br>function TCoolTrayIcon.ModifyIcon: Boolean;<br>// Change icon or tooltip if icon already placed<br>begin<br> Result := False;<br> if InitIcon then<br> Result := Shell_NotifyIcon(NIM_MODIFY, @IconData);<br>end;<br>