Delphi调用IUserNotification2显示气泡提示

IUserNotification2 interface

Exposes methods that set notification information and then display that notification to the user in a balloon that appears in conjunction with the notification area of the taskbar.

Note  IUserNotification2 does not inherit from IUserNotification. IUserNotification2 differs from IUserNotification only in its Show method, which adds an additional parameter for a callback interface to communicate with the notification. Otherwise the two interfaces are identical in form and function. CLSID_UserNotification implements both versions of Show as an overload.

以上是MSDN对IUserNotification2的解释,IUserNotification2与IUserNotification接口功能差不多,除了Show方法不同外,IUserNotification2的Show方法多了IQueryContinue, IUserNotificationCallback接口,用于对气泡提示的用户操作事件进行响应控制.

主要的代码如下,TFormMain已实现了IQueryContinue, IUserNotificationCallback接口:

procedure TFormMain.Button1Click(Sender: TObject);
begin
  I.SetIconInfo(Application.Icon.Handle, 'IUserNotification2演示');
  I.SetBalloonInfo('提示标题', '这是提示内容', 3);
  I.SetBalloonRetry(1000, 5000, 3);
  I.Show(self as IQueryContinue, 1000, self as IUserNotificationCallback);
end;

 

源代码下载:http://www.ctdisk.com/file/12852384

 

程序运行示图:

Delphi调用IUserNotification2显示气泡提示_第1张图片

气泡提示效果:

你可能感兴趣的:(Delphi调用IUserNotification2显示气泡提示)