Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Chat biutente (Client) - trybar client.bas

trybar client.bas

Caricato da: Roberto VB
Scarica il programma completo

  1. Attribute VB_Name = "Module4"
  2. Option Explicit
  3.  
  4.  
  5. 'Codice per la tryicon
  6. 'user defined type required by Shell_NotifyIcon API call
  7. Public Type NOTIFYICONDATA
  8.     cbSize As Long
  9.     hWnd As Long
  10.     uId As Long
  11.     uFlags As Long
  12.     uCallBackMessage As Long
  13.     hIcon As Long
  14.     szTip As String * 64
  15. End Type
  16.  
  17. 'constants required by Shell_NotifyIcon API call:
  18. Public Const NIM_ADD = &H0
  19. Public Const NIM_MODIFY = &H1
  20. Public Const NIM_DELETE = &H2
  21. Public Const NIF_MESSAGE = &H1
  22. Public Const NIF_ICON = &H2
  23. Public Const NIF_TIP = &H4
  24. Public Const WM_MOUSEMOVE = &H200
  25. Public Const WM_LBUTTONDOWN = &H201     'Button down
  26. Public Const WM_LBUTTONUP = &H202       'Button up
  27. Public Const WM_LBUTTONDBLCLK = &H203   'Double-click
  28. Public Const WM_RBUTTONDOWN = &H204     'Button down
  29. Public Const WM_RBUTTONUP = &H205       'Button up
  30. Public Const WM_RBUTTONDBLCLK = &H206   'Double-click
  31.  
  32. Public Declare Function SetForegroundWindow Lib "user32" (ByVal hWnd As Long) As Long
  33. Public Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
  34.  
  35. Public nid As NOTIFYICONDATA
  36.  
  37. Public Sub InitSystray(callback As Object, icon As IPictureDisp, testo As String)
  38.  
  39.        'the form must be fully visible before calling Shell_NotifyIcon
  40.        With nid
  41.         .cbSize = Len(nid)
  42.         .hWnd = callback.hWnd
  43.         .uId = vbNull
  44.         .uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
  45.         .uCallBackMessage = WM_MOUSEMOVE
  46.         .hIcon = icon.Handle
  47.         .szTip = testo & vbNullChar
  48.        End With
  49.        Shell_NotifyIcon NIM_ADD, nid
  50.  
  51. End Sub
  52.  
  53.  
  54. Public Sub TermSysTray()
  55.           'this removes the icon from the system tray
  56.         Shell_NotifyIcon NIM_DELETE, nid
  57. End Sub