24/02/08 14:31
mad hacker
ho messo un codice in un commandbutton per far sì che quando lo premo, la form vada nella barra delle applicazioni...ho fatto in modo che si veda l'icona e tutto funziona correttamente...tranne che quando schiaccio sull'icona la form nn si apre...come mai?
ecco il codice del commandbutton
e quello nel modulo
ecco il codice del commandbutton
Private Sub cmdTrybar_Click() nid.cbSize = Len(nid) nid.hWnd = Form1.hWnd nid.uId = 0 nid.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE nid.uCallBackMessage = WM_MOUSEMOVE nid.hIcon = icon Shell_NotifyIcon NIM_ADD, nid Me.WindowState = vbMinimized Me.Hide End Sub
e quello nel modulo
Option Explicit API call Public 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 'constants required by Shell_NotifyIcon API call: Public Const NIM_ADD = &H0 Public Const NIM_MODIFY = &H1 Public Const NIM_DELETE = &H2 Public Const NIF_MESSAGE = &H1 Public Const NIF_ICON = &H2 Public Const NIF_TIP = &H4 Public Const WM_MOUSEMOVE = &H200 Public Const WM_LBUTTONDOWN = &H201 Public Const WM_LBUTTONUP = &H202 Public Const WM_LBUTTONDBLCLK = &H203 Public Const WM_RBUTTONDOWN = &H204 Public Const WM_RBUTTONUP = &H205 Public Const WM_RBUTTONDBLCLK = &H206 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 nid As NOTIFYICONDATA Public Sub InitSystray(callback As Object, icon As IPictureDisp, testo As String) calling Shell_NotifyIcon With nid .cbSize = Len(nid) .hWnd = callback.hWnd .uId = vbNull .uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE .uCallBackMessage = WM_MOUSEMOVE .hIcon = icon.Handle .szTip = testo & vbNullChar End With Shell_NotifyIcon NIM_ADD, nid End Sub Public Sub TermSysTray() Shell_NotifyIcon NIM_DELETE, nid End Sub
Ultima modifica effettuata da mad hacker 24/02/08 18:19
aaa