VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Is a small Application for displaying icon on a Task bar

by Swapnil Soni (1 Submission)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 15th June 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Is a small Application for displaying icon on a Task bar

Rate Is a small Application for displaying icon on a Task bar



' system to show icon in a taskbar
' it contain two parameter first give message what to be
' done another parameter notifyicon object which contain the
' property of icon

Private Declare Function Shell_NotifyIcon Lib _
"shell32.dll" Alias "Shell_NotifyIconA" _
(ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long

'To create structure which variable contain the property of icon
Private Type NOTIFYICONDATA
        cbSize As Long
        hwnd As Long
        uID As Long
        uFlags As Long
        uCallbackMessage As Long
        hIcon As Long
        szToolTip As String * 64
End Type
'then create a object which pass the NotifyIcon procedure
Dim notify As NOTIFYICONDATA
'It declare the constant value
Const NIM_ADD = &H0 'constant value for add the icon in a taskbar
Const NIM_DELETE = &H2 'constant value for remove the icon in a taskbar
Const NIF_TIP = &H4
Const NIF_MESSAGE = &H1
Const NIF_ICON = &H2
Const WM_MOUSEMOVE = &H200



Private Sub Form_Load()
Me.mnurun.Checked = False
Me.mnuStop.Checked = False
    With notify
        .cbSize = Len(obj)
        .hwnd = Picture1.hwnd 'to assign the pointer or handle
                              'property of picture
         .uID = 1&
         .uFlags = NIF_TIP Or NIF_MESSAGE Or NIF_ICON
        .uCallbackMessage = WM_MOUSEMOVE
    
        .hIcon = Picture1.Picture
        .szToolTip = "Yellow Color" 'to show the message when
                                    'mouse over on the icon
         
    End With
       
    'lastly,we setup the icon througth the procedre
    Shell_NotifyIcon NIM_ADD, notify 'first give message to add
                                     'the icon in a taskbar
End Sub

Private Sub mnurun_Click()
Me.mnurun.Checked = True
Me.mnuStop.Checked = False
'Load Form1
End Sub

Private Sub mnuStop_Click()
Me.mnurun.Checked = False
Me.mnuStop.Checked = True

    Shell_NotifyIcon NIM_DELETE, notify
'    Unload Form1
    Unload Me
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 2 Then
        Me.PopupMenu Main
    End If
End Sub


Download this snippet    Add to My Saved Code

Is a small Application for displaying icon on a Task bar Comments

No comments have been posted about Is a small Application for displaying icon on a Task bar. Why not be the first to post a comment about Is a small Application for displaying icon on a Task bar.

Post your comment

Subject:
Message:
0/1000 characters