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 (Server) - module1 server.bas

module1 server.bas

Caricato da: Roberto VB
Scarica il programma completo

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