NOTIFYICONSTRUCTURE

Type NOTIFYICONDATA
  cbSize As Long
  hWnd As Long
  uID As Long
  uFlags As Long
  uCallbackMessage As Long
  hIcon As Long
  szTip As String * 64  ' Windows 2000: make this String * 128
  ' The following data members are only valid in Windows 2000!
  ' (uncomment the following lines to use them)
  'dwState As Long
  'dwStateMask As Long
  'szInfo As String * 256
  'uTimeoutOrVersion As Long
  'szInfoTitle As String * 64
  'dwInfoFlags As Long
End Type
  

Description & Usage

The NOTIFYICONDATA structure stores information used to communicate with an icon in the system tray. The structure holds data that both identifies and describes settings for the icon in question. Windows 2000 expands significantly on this structure, adding multiple data members not available in previous versions of Windows.

Visual Basic-Specific Issues

Windows 2000: Officially, the uTimeoutOrVersion data member is actually two separate data members, uTimeout and uVersion, which occupy the same space within the structure. Because Visual Basic does not support unions like C++ does, it is necessary to assign a single name to this data member. Nevertheless, using this pseudonym involves no loss of functionality.

Data Members

cbSize
The size in bytes of the structure.
hWnd
A handle to the window that owns the tray icon. This window will process any events generated by the icon.
uID
The application-definied identifier that uniquely identifies the tray icon. This value allows a single window to own multiple tray icons, allowing the window to tell the difference between them.
uFlags
A combination of the following flags specifying which of the subsequent members of the structure contain useful data. Any data members not identified by a flag will be ignored.
NIF_ICON
The hIcon data member.
NIF_MESSAGE
The uCallbackMessage data member.
NIF_TIP
The szTip data member.
NIF_STATE
Windows 2000: The dwState and dwStateMask data members.
NIF_INFO
Windows 2000: Use a balloon-style tooltip instead of the regular pop-up tooltip. The szInfo, szTimeOut, szInfoTitle, and dwInfoFlags data members are used.
uCallbackMessage
An application-defined message identifier. This message is sent to the owning window whenever an event occurs related to the tray icon. These events are primarily when the mouse moves or clicks over the icon or when it receives keyboard input. The wParam parameter will be the application-defined identifier of the tray icon that generated the message. The lParam parameter will be the "real" Windows message identifier for the event that occured.
hIcon
A handle to the icon to display in the tray.
szTip
The null-terminated string to use for the icon's standard tooltip text. This text appears when the mouse cursor hovers over the icon.
dwState
Windows 2000: A combination of the following flags specifying the icon's state. Each flag is an independent toggle.
NIS_HIDDEN
The icon is hidden.
NIS_SHAREDICON
The icon is shared.
dwStateMask
Windows 2000: A combination of the above flags that specifies which of the dwState flags to retrieve or modify.
szInfo
Windows 2000: The null-terminated string to use for the icon's balloon-style tooltip.
uTimeoutOrVersion
Windows 2000: The timeout value, in milliseconds, for the display of the balloon-style tooltip. If outside of Windows's allowable range, the timeout value will be "pushed" into the range of valid timeout periods.

Or, if Shell_NotifyIcon had been called with the NIM_VERSION flag, this instead specifies whether to use Windows 95 or Windows 2000 behavior. By default, Windows 2000 will use different messages in some cases to communicate with the owning window. For backward compatibility, you should use the older behavior. This is one of the following flags:
0
Use the Windows 95-style behavior.
NOTIFYICON_VERSION
Use the Windows 2000-style behavior.
szInfoTitle
The null-terminated string to use as the title of the balloon tooltip. This will appear in boldface above the regular text.
dwInfoFlags
If desired, one of the following flags specifying the icon to display to the left of the balloon tooltip text. Set this as 0 to not use an icon.
NIIF_WARNING
A warning icon.
NIIF_ERROR
An error icon.
NIIF_INFO
An information icon.

Constant Definitions

Const NIF_ICON = &H2
Const NIF_MESSAGE = &H1
Const NIF_TIP = &H4
Const NIF_STATE = &H8
Const NIF_INFO = &H10
Const NIS_HIDDEN = &H1
Const NIS_SHAREDICON = &H2
Const NOTIFYICON_VERSION = &H1
Const NIIF_WARNING = &H30
Const NIIF_ERROR = &H10
Const NIIF_INFO = &H40

Used By

Shell_NotifyIcon

Back to the Structure list.
Back to the Reference section.


Last Modified: March 19, 2000
This page is copyright © 2000 Paul Kuliniewicz. Copyright Information Revised October 29, 2000
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/n/notifyicondata.html