Results 1 to 2 of 2

Thread: any expert on system tray icon ..

  1. #1

    Thread Starter
    Addicted Member chander's Avatar
    Join Date
    Nov 2000
    Location
    New Delhi , India
    Posts
    225

    any expert on system tray icon ..

    i m facing a problem with my system tray.it is working on all aspects but a single problem is that when i take mouse to tray icon for doing some action , then just on mouse over my mail application window ( for what icon is there ) comes/popup up.
    it should come on double click but just on mouse move it popup up.i m using shellnotify API function with NOTIFYICON data structure.i m pasing my code down here. i just took help for this code also , so dont have proper idea of it ... i m putting my comment like * my comment * where i have doubt .pls let me know fi some thing wrong at any place ....

    put one image box(imgicon) and one picture box(pichook) on a form and try this code and see on just mousemove form comes up.

    here is my code :
    '----------------------------------------------------------

    ' In Declaration :

    Private 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

    Private Type CREATESTRUCT
    lpCreateParams As Long
    hInstance As Long
    hMenu As Long
    hWndParent As Long
    cy As Long
    cx As Long
    Y As Long
    X As Long
    style As Long
    lpszName As String
    lpszClass As String
    ExStyle As Long
    End Type

    Private Const NIM_ADD = &H0
    Private Const NIM_MODIFY = &H1
    Private Const NIM_DELETE = &H2
    Private Const NIF_MESSAGE = &H1
    Private Const NIF_ICON = &H2
    Private Const NIF_TIP = &H4

    Private Const WM_LBUTTONDOWN = &H201
    Private Const WM_RBUTTONDOWN = &H204
    Private Const WM_RBUTTONUP = &H205

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

    ' In Form Load

    TrayI.cbSize = Len(TrayI)
    TrayI.hwnd = pichook.hwnd 'Link the trayicon to this picturebox
    TrayI.uId = 1&
    TrayI.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
    TrayI.uCallbackMessage = WM_LBUTTONDOWN
    TrayI.hIcon = imgicon.Picture
    TrayI.szTip = "Switch Notes" & Chr$(0)

    'Create the icon

    Me.Icon = imgicon.Picture
    Shell_NotifyIcon NIM_ADD, TrayI

    ' i am having one imagebox(imgicon) and one picturebox ( pichook ) and taking imgicon's picture for picture box and using piturebox handle for tray icon's handle.

    ' -----------------------------------------------------------

    thanks
    Chander
    Email:[email protected]

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    There are many examples of how to achieve this task, you can find them using the Search facility of this site.

    Here's one of my own many Examples

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width