iconetrayballoon.pas

来自「Source Code TrayIcon and BaloonHint」· PAS 代码 · 共 67 行

PAS
67
字号
{
  Use the AddSysTrayIcon procedure to add icon to notification area
  (in FormCreate, for example), and use the ShowBalloonTips procedure
  when ever you want(of cause must after you called AddSysTrayIcon procedure),
  and finally call DeleteSysTrayIcon procedure to remove icon from
  notification area after your using.
  Add propriety code to the callback message handler.

  The new feature require IE5 or later.
}

unit IconeTrayBalloon;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, JvComponentBase, JvTrayIcon, ShellAPI;

{new constant definitions}

const
  NIF_INFO = $10;
  NIF_MESSAGE = 1;
  NIF_ICON = 2;
  NOTIFYICON_VERSION = 3;
  NIF_TIP = 4;
  NIM_SETVERSION = $00000004;
  NIM_SETFOCUS = $00000003;

  NIIF_NONE = $00000000;
  NIIF_INFO = $00000001;
  NIIF_WARNING = $00000002;
  NIIF_ERROR = $00000003;

  NIN_BALLOONSHOW = WM_USER + 2;
  NIN_BALLOONHIDE = WM_USER + 3;
  NIN_BALLOONTIMEOUT = WM_USER + 4;
  NIN_BALLOONUSERCLICK = WM_USER + 5;
  NIN_SELECT = WM_USER + 0;
  NINF_KEY = $1;
  NIN_KEYSELECT = NIN_SELECT or NINF_KEY;

  {outras constantes podem ser encontradas no vs.net---vc7's dir: PlatformSDK\Include\ShellAPI.h}

  {definir a chamada mensagem}
  TRAY_CALLBACK = WM_USER + $7258;

  {nova defini玢o da estrutura NotifyIconData}
type
  TBalloon = (bNone, bError, bInfo, bWarning);
  PNewNotifyIconData = ^TNewNotifyIconData;

  TDUMMYUNIONNAME    = record
    case Integer of
      0: (uTimeout: UINT);
      1: (uVersion: UINT);
  end;

  TNewNotifyIconData = record
    cbSize: DWORD;
    Wnd: HWND;
    uID: UINT;
    uFlags: UINT;
    uCallbackMessage: UINT;
    hIcon: HICON;
   //Vers鉶 5.0 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?