Discussion Locked

System Tray and NotifyIconData

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I'd like to ask how could i put my application into a system tray when it's not needed ??? I looked into help and found some API functions ( NIM_ADD, NotifyIconData), but i couldn't understand all the parameters. Could any1 help me ???

Thanx

6 replies

by shanghai sam

'Declare a user-defined variable to pass to the Shell_NotifyIcon
'function.
Public Type NOTIFYICONDATA
cbSize As Long
hwnd As Long
uId As Long
uFlags As Long
uCallBackMessage As Long
hIcon As Long
szTip As String * 64
End Type

'The following constants are the messages sent to the
'Shell_NotifyIcon function to add, modify, or delete an icon from the
'taskbar status area.
Public Const NIM_ADD = &H0
Public Const NIM_MODIFY = &H1
Public Const NIM_DELETE = &H2
'The following constant is the message sent when a mouse event occurs
'within the rectangular boundaries of the icon in the taskbar status
'area.
Public Const WM_MOUSEMOVE = &H200

'The following constants are the flags that indicate the valid
'members of the NOTIFYICONDATA data type.
Public Const NIF_MESSAGE = &H1
Public Const NIF_ICON = &H2
Public Const NIF_TIP = &H4

'The following constants are used to determine the mouse input on the
'the icon in the taskbar status area.

'Left-click constants.
Public Const WM_LBUTTONDBLCLK = &H203 'Double-click
Public Const WM_LBUTTONDOWN = &H201 'Button down
Public Const WM_LBUTTONUP = &H202 'Button up

'Right-click constants.
Public Const WM_RBUTTONDBLCLK = &H206'Double-click
Public Const WM_RBUTTONDOWN = &H204 'Button down
Public Const WM_RBUTTONUP = &H205 'Button up

'Declare the API function call.
Public Declare Function Shell_NotifyIcon Lib "shell32" _
Alias "Shell_NotifyIconA" _
(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean

'Dimension a variable as the user-defined data type.
Public Utypenid As NOTIFYICONDATA

by rsv

HI,
Here is the full coding for you above question.
*********************
Step 1:
Create a menu as follows
main menu
name: &SysTry value: mPopSys
sub menu
name: &Restore value: mPopRestore
name: &Exit value: mPopExit

Step 2:oops!!!! sorry I can't type full coding here due the limited characters. Anyway I will be emailing you the full code.

*****************************
Hope this is helpful to you.
GOOD LUCK

This discussion is closed to new replies.