• May 18, 2022, 06:51:36 am

Author Topic: why isnt it working?  (Read 1441 times)


  • Sr. Member
  • ******
  • Posts: 437
  • The Legacy
    • The Legacy
why isnt it working?
« on: July 23, 2008, 12:33:08 pm »
my tray icon is not coming back up wen i put it in the tray here's my code:

Code: [Select]

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single)

    Dim cEvent As Single
    cEvent = X / Screen.TwipsPerPixelX
    Select Case cEvent
        Case LeftDbClick
            frmMain.WindowState = vbNormal
        Case RightUp
            PopupMenu mnuForm
    End Select

End Sub

Code: [Select]

Private Sub Form_Resize()
    If Me.WindowState = 1 Then
        TrayAdd hwnd, Me.Icon, "GChat", MouseMove
        Exit Sub
    End If
    If Not Me.WindowState = vbMinimized Then
        Me.Width = 10245
        Me.Height = 6990
    End If
End Sub


Code: [Select]

Option Explicit

''''' credits go to Jim Jose of pscode.com for this excellent module

'[Tray Constants]
Const NIF_MESSAGE    As Long = &H1     'Message
Const NIF_ICON       As Long = &H2     'Icon
Const NIF_TIP        As Long = &H4     'TooTipText
Const NIM_ADD        As Long = &H0     'Add to tray
Const NIM_MODIFY     As Long = &H1     'Modify
Const NIM_DELETE     As Long = &H2     'Delete From Tray

'[Type NotifyIconData For Tray Icon]
    cbSize As Long
    hwnd As Long
    uId As Long
    uFlags As Long
    uCallBackMessage As Long
    hIcon As Long
    szTip As String * 64
End Type

'[Return Events]
Public Enum TrayRetunEventEnum
    MouseMove = &H200       'On Mousemove
    LeftUp = &H202          'Left Button Mouse Up
    LeftDown = &H201        'Left Button MouseDown
    LeftDbClick = &H203     'Left Button Double Click
    RightUp = &H205         'Right Button Up
    RightDown = &H204       'Right Button Down
    RightDbClick = &H206    'Right Button Double Click
    MiddleUp = &H208        'Middle Button Up
    MiddleDown = &H207      'Middle Button Down
    MiddleDbClick = &H209   'Middle Button Double Click
End Enum

'[Modify Items]
Public Enum ModifyItemEnum
    ToolTip = 1             'Modify ToolTip
    Icon = 2                'Modify Icon
End Enum

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

'[Add to Tray]
Public Sub TrayAdd(hwnd As Long, Icon As Picture, _
                    ToolTip As String, ReturnCallEvent As TrayRetunEventEnum)
    With TrayIcon
        .cbSize = Len(TrayIcon)
        .hwnd = hwnd
        .uId = vbNull
        .uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
        .uCallBackMessage = ReturnCallEvent
        .hIcon = Icon
        .szTip = ToolTip & vbNullChar
    End With
    Shell_NotifyIcon NIM_ADD, TrayIcon
End Sub

'[Remove From tray]
Public Sub TrayDelete()
    Shell_NotifyIcon NIM_DELETE, TrayIcon
End Sub

'[Modify the tray]
Public Sub TrayModify(Item As ModifyItemEnum, vNewValue As Variant)
    Select Case Item
        Case ToolTip
            TrayIcon.szTip = vNewValue & vbNullChar
        Case Icon
            TrayIcon.hIcon = vNewValue
    End Select
    Shell_NotifyIcon NIM_MODIFY, TrayIcon
End Sub

i made the menu for it and everything, my friend tried to fix it but he had no luck so can one of you help me?
« Last Edit: December 31, 1969, 07:00:00 pm by BaDaSs »
Op Legacy@USEast


  • Super Moderator
  • Hero Member
  • ******
  • Posts: 1,638
  • SaNNy
why isnt it working?
« Reply #1 on: July 23, 2008, 02:07:19 pm »
well theres your problem


  • All Your Base Are Belong To Us.
  • Addict
  • *****
  • Posts: 101
why isnt it working?
« Reply #2 on: July 31, 2008, 12:08:56 am »
What exactly is the problem? When you right-click do you get your mnuForm?
Also, Does your Tray Icon remove itself when you double-click?
I hate to advocate drugs, alcohol, violence, or insanity to anyone, but they've always worked for me.
In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity.
-Op N1 @USEast-


newBalance by DzinerStudio