A algunos seguro les será bienvenido a otros no, pero es sólo para compartir experiencia.
Código
Option Explicit Private Declare Function SetErrorMode Lib "kernel32" (ByVal wMode As Long) As Long Private Declare Sub InitCommonControls Lib "Comctl32" () Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" ( _ ByVal hWnd1 As Long, _ ByVal hWnd2 As Long, _ ByVal lpsz1 As String, _ ByVal lpsz2 As String) As Long Private Declare Function ShowWindow Lib "user32" ( _ ByVal hwnd As Long, _ ByVal nCmdShow As Long) As Long Private Const SW_SHOW = 5 Private Const SW_HIDE = 0 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_LBUTTONDBLCLK = &H203 Private Const WM_LBUTTONDOWN = &H201 Private Const WM_RBUTTONUP = &H205 Private Const KEY_TOGGLED As Integer = &H1 Private Const KEY_PRESSED As Integer = &H1000 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 Dim sysTray As NOTIFYICONDATA Private Sub Command1_Click() MsgBox " Hacer Doble click en el ícono para reestaurar el Form", vbInformation, "SH_DEKTOP" Call Colocar_Tray(1000) End Sub Private Sub Command2_Click() Call Quitar_Systray End Sub Sub Colocar_Tray(Intervalo As Integer) With sysTray .cbSize = Len(sysTray) .hwnd = Me.hwnd .uId = 1& .uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE .ucallbackMessage = WM_LBUTTONDOWN .hIcon = Image1.Picture End With Call Shell_NotifyIcon(NIM_ADD, sysTray) Me.Hide Timer1.Interval = Intervalo End Sub Sub Quitar_Systray() With sysTray .cbSize = Len(sysTray) .hwnd = Me.hwnd .uId = 1& End With Call Shell_NotifyIcon(NIM_DELETE, sysTray) End Sub Private Sub Command3_Click() End End Sub Private Sub Form_Initialize() Call SetErrorMode(2) Call InitCommonControls Me.Caption = "SH_DEKTOP" End Sub Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim msg msg = X / Screen.TwipsPerPixelX If msg = WM_LBUTTONDBLCLK Then mnuMostrar_Click ElseIf msg = WM_RBUTTONUP Then Me.PopupMenu mnuPopup End If End Sub Private Sub mnuMostrar_Click() Timer1.Interval = 0 Me.Show End Sub Private Sub mnuSalir_Click() Unload Me End Sub Private Sub Timer1_Timer() sysTray.hIcon = Image1.Picture Call Shell_NotifyIcon(NIM_MODIFY, sysTray) End Sub Private Sub Form_Load() Image1.Visible = False Command1.Caption = " Colocar en el systray " Command2.Caption = " Quitar del sysTray " Command3.Caption = "Salir" Timer2.Enabled = True Timer2.Interval = 100 End Sub Private Sub Form_Unload(Cancel As Integer) Quitar_Systray End End Sub Private Sub Timer2_Timer() If GetKeyState(vbKeyF10) And KEY_PRESSED Then Dim HWND_Escritorio As Long On Error Resume Next HWND_Escritorio = FindWindowEx(0&, 0&, "Progman", vbNullString) Call ShowWindow(HWND_Escritorio, SW_HIDE) ElseIf GetKeyState(vbKeyF11) And KEY_PRESSED Then On Error Resume Next HWND_Escritorio = FindWindowEx(0&, 0&, "Progman", vbNullString) Call ShowWindow(HWND_Escritorio, SW_SHOW) End If End Sub