INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How to make systray from a Trayballon code

How to make systray from a Trayballon code

(OP)

Hello guys,

I've got two codes, one for SYSTRAY (in a class module) and another for TRAYBALLONTIP (in a module), both working perfectly, (I mean SYSTRAY give me an icon that I implemented some menus, and the TRAYBALLONTIP display me a Tooltip in systray bar with its own icon; so in brief I have two ICON in the systray bar; It's really something that I don't refuz !!!)


The Systray API use
Code:

CODE --> Vb6

Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pIconSystray As NOTIFYICONDATA) As Boolean 

and TRAYBALLONTIP use this API

CODE --> Vb6

Public Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIF[/sup]YICONDATA) As Boolean 

plus

CODE --> Vb6

Public Declare Function SetForegroundWindow Lib "user32" (ByVal hWnd As Long) As Long 

and this is the whole code for the TRAYBALLONTIP in Module :

CODE --> Vb6

'Notice the changes here from the old 'standard' NOTIFYICONDATA
 Public Type NOTIFYICONDATA
   cbSize As Long
   hWnd As Long
   uID As Long
   uFlags As Long
   uCallbackMessage As Long
   hIcon As Long
   szTip As String * 128
   dwState As Long
   dwStateMask As Long
   szInfo As String * 256
   uTimeout As Long
   szInfoTitle As String * 64
   dwInfoFlags As Long
End Type

 
Public Const NOTIFYICON_VERSION = 3       'V5 style taskbar
Public Const NOTIFYICON_OLDVERSION = 0    'Win95 style taskbar

Public Const NIM_ADD = &H0
Public Const NIM_MODIFY = &H1
Public Const NIM_DELETE = &H2

Public Const NIM_SETFOCUS = &H3
Public Const NIM_SETVERSION = &H4

Public Const NIF_MESSAGE = &H1
Public Const NIF_ICON = &H2
Public Const NIF_TIP = &H4

Public Const NIF_STATE = &H8
Public Const NIF_INFO = &H10
 
Public Const NIS_HIDDEN = &H1
Public Const NIS_SHAREDICON = &H2
 
Public Const NIIF_NONE = &H0
Public Const NIIF_WARNING = &H2
Public Const NIIF_ERROR = &H3
Public Const NIIF_INFO = &H1
Public Const NIIF_GUID = &H4

Public Const WM_MOUSEMOVE = &H200
Public Const WM_LBUTTONDOWN = &H201
Public Const WM_LBUTTONUP = &H202
Public Const WM_LBUTTONDBLCLK = &H203
Public Const WM_RBUTTONDOWN = &H204
Public Const WM_RBUTTONUP = &H205
Public Const WM_RBUTTONDBLCLK = &H206
 
Public Declare Function SetForegroundWindow Lib "user32" _
(ByVal hWnd As Long) As Long
Public Declare Function Shell_NotifyIcon Lib "shell32" _
Alias "Shell_NotifyIconA" _
(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean 

another TRAYBALLONTIP code in GENERAL DECLARATION Section of the mainForm :

CODE --> Vb6

Private m_IconData As NOTIFYICONDATA 

and the last TRAYBALLONTIP code in the mainForm to handle the event "MINIMIZE WINDOW", when the user try to minimize the window the TRAYBALLONTIP display a tooltip to inform, with message "the window has been minimized on the systray bar"

CODE --> Vb6

'Set up the structure
' IF szInfoTitle and szInfo are not terminated with 'null' the box is huge!
With m_IconData
    .cbSize = Len(m_IconData)
    .hWnd = Me.hWnd
    .uID = vbNull
    .uFlags = NIF_ICON Or NIF_INFO Or NIF_MESSAGE Or NIF_TIP
    .uCallbackMessage = WM_MOUSEMOVE
    .hIcon = Me.Icon
    '.szTip = "Your Message Here" & vbNullChar
    .dwState = 0
    .dwStateMask = 0
    .szInfo = "  L'application est minimisée dans la zone de notification" & Chr(0)
    .szInfoTitle = " Dictionnaire " & Chr(0)
    .dwInfoFlags = NIIF_INFO
    .uTimeout = 3000
End With


Shell_NotifyIcon NIM_ADD, m_IconData

Shell_NotifyIcon NIM_MODIFY, m_IconData 

I tried to work on it with the aim of having only two APIs, instead of 3, and the whole in a module, but I failled, as I'm not really very EXCELLENT in this staff.

My concern is : I need to implement a SYSTRAY with the same code of TRAYBALLONTIP.

If you need more details about it, do not hesitate to ask me.

Please How to do???

RE: How to make systray from a Trayballon code

(OP)
Many thanks !

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close