Home Page Free Software CCTV Products CCTV Samples Local Services Offshore Services Contact Us

Computer Repair
Tel: 242-364-9183
Nassau, Bahamas
Bahamas Video Surveillance . Bahamas CCTV . Bahamas Infrared . Bahamas Digital Video . Bahamas Remote Video . Bahamas Burglar Alarm . Bahamas Technician
Bahamas Real Estate
Bahamas Yellow Pages


Free Software:


We Recommend:
MediaFire - Free File Hosting Made Simple
Follow us on:
Twitter Twitter


 

Tray Icon Module

Place your application in the system tray with an easy to use module.
Download VB6 project. (13 downloads)
Form1.frm  - Example Form
 
      
Option Explicit

'// FORM

Private Sub Form_Load()
    mTray.Refresh Me                            ' TRAY ICON LOAD
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    mTray.Click Me, X                           ' TRAY ICON CLICK
End Sub

Private Sub Form_Resize()
    mTray.Resize Me                             ' TRAY ICON SHOW/HIDE
End Sub

Private Sub Form_Unload(Cancel As Integer)
    mTray.Destroy                               ' TRAY ICON CLOSE
End Sub

mTray.bas - Tray Icon Module

Option Explicit

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

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

Public nid As NOTIFYICONDATA

Private FX As Single
Private FY As Single

Const NIM_ADD = &H0
Const NIM_MODIFY = &H1
Const NIM_DELETE = &H2
Const WM_MOUSEMOVE = &H200
Const NIF_MESSAGE = &H1
Const NIF_ICON = &H2
Const NIF_TIP = &H4
Const WM_LBUTTONDBLCLK = &H203
Const WM_LBUTTONDOWN = &H201
Const WM_LBUTTONUP = &H202
Const WM_RBUTTONDBLCLK = &H206
Const WM_RBUTTONDOWN = &H204
Const WM_RBUTTONUP = &H205

Public Sub Refresh(ByVal frm As Form)
    FX = frm.Width
    FY = frm.Height
    nid.cbSize = Len(nid)
    nid.hwnd = frm.hwnd
    nid.uId = vbNull
    nid.uflags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
    nid.uCallBackMessage = WM_MOUSEMOVE
    nid.hIcon = frm.Icon
    nid.szTip = App.Title & vbNullChar
    Call Shell_NotifyIcon(NIM_ADD, nid)
End Sub

Public Sub Click(ByVal frm As Form, ByVal X As Single)
    Dim Msg As Long
    Dim sFilter As String
    Msg = X / Screen.TwipsPerPixelX
    Select Case Msg
        Case WM_LBUTTONDOWN
            frm.WindowState = 0
            frm.Show
        Case WM_LBUTTONUP
        Case WM_LBUTTONDBLCLK
        Case WM_RBUTTONDOWN
        Case WM_RBUTTONUP
        Case WM_RBUTTONDBLCLK
    End Select
End Sub

Public Sub Resize(ByVal frm As Form)
    If frm.WindowState = 1 Then
        frm.Hide
        frm.WindowState = 0
    ElseIf frm.WindowState = 0 Then
        frm.Show
        frm.Width = FX
        frm.Height = FY
    End If
End Sub

Public Sub Destroy()
    Call Shell_NotifyIcon(NIM_DELETE, nid)
End Sub    

Bahamas CCTV . Bahamas DVR . Bahamas Camera . Bahamas Video . Bahamas Computer Repair . Bahamas Software . Bahamas Business . Bahamas Real Estate
Copyright (c) 2001/2010 BahamasSecurity.com