noc si te sirva man no son como los grandes codes que postean aki estos grandes !
'esto va en un modulo.bas
'lo modifique y lo cree a mi gusto con funciones esta bn pero lo pueden modificar mas si kieren
'_k4tz3_ vb6.0
Public Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
Public Type NOTIFYICONDATA
cbSize As Long
hwnd As Long
uId As Long
uFlags As Long
uCallBackMessage As Long
hIcon As Long
szTip As String * 128
dwState As Long
dwStateMask As Long
szInfo As String * 256
uTimeout As Long
szInfoTitle As String * 64
dwInfoFlags As Long
End Type
Public Const NIM_ADD = &H0
Public Const NIM_DELETE = &H2
Public Const NIF_MESSAGE = &H1
Public Const NIF_ICON = &H2
Public Const NIF_INFO = &H10
Public Const NIF_TIP = &H4
Public Const WM_MOUSEMOVE = &H200
Public Const WM_LBUTTONDBLCLK = &H203
Public Const WM_LBUTTONDOWN = &H201
Public Const WM_LBUTTONUP = &H202
Public Const WM_RBUTTONDBLCLK = &H206
Public Const WM_RBUTTONDOWN = &H204
Public Const WM_RBUTTONUP = &H205
Public nID As NOTIFYICONDATA
Public Function CierraTray(frm As Form)
With nID
.cbSize = Len(nID)
.hwnd = frm.hwnd
.uId = 1&
End With
Shell_NotifyIcon NIM_DELETE, nID
End Function
Public Function showfrm(frm As Form)
If frm.WindowState = 1 Then frm.WindowState = 0
frm.Show
End Function
Public Function tray(frm As Form, Title As String)
With nID
.cbSize = Len(nID)
.hwnd = frm.hwnd
.uId = vbNull
.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE Or NIF_INFO
.uCallBackMessage = WM_MOUSEMOVE
.hIcon = frm.Icon
.szTip = Title & Chr(0) '& vbNullChar
.dwState = 0
.dwStateMask = 0
.szInfoTitle = "mensaje" & Chr(0)
.szInfo = "mensaje" & vbNullChar
.uTimeout = 1
End With
Shell_NotifyIcon NIM_ADD, nID
End Function
con esto seria mas o menos una forma de aplicarlo !!!
Private Declare Function ReleaseCapture Lib "user32.dll" () As Long
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_NCLBUTTONDOWN As Long = &HA1
Private Const HTCAPTION As Long = 2
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
ReleaseCapture
SendMessage hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
Dim lResult As Long
Dim lMsg As Long
If Me.ScaleMode = vbPixels Then
lMsg = x
Else
lMsg = x / Screen.TwipsPerPixelX
End If
Select Case lMsg
Case WM_RBUTTONUP
lResult = SetForegroundWindow(Me.hwnd)
Me.PopupMenu mmenutray 'click derecho en el systray llama al popumenu dado en parametro !
Case WM_LBUTTONDBLCLK
If Me.Visible = False Then
Call showfrm(Me) ' llamamos al formulario llamando a showfrm!
End If
End Select
End Sub
'para llamar al systray cuando se minimized
Private Sub Form_Resize()
If Me.WindowState = vbMinimized Then
Call tray(Me, "hola")
Me.Hide
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call CierraTray(Me)
end sub
'mas claro que el agua