anoniem Geplaatst: 7 september 2003 Delen Geplaatst: 7 september 2003 Hey, Ik wil in Visual Basic 6 een programma maken die alleen als icoontje (zoals bijvoorbeeld MSN) in de icon tray staat. Op een gegeven moment moet er dan een soort pop-upje verschijnen (ook zoals in MSN :P) en dat ook rechtsonderin. Hoe kan ik dit het beste doen? Groeten, Mark Quote Link naar reactie
anoniem Geplaatst: 8 september 2003 Auteur Delen Geplaatst: 8 september 2003 er zit een stukje code voor gebruik van de systray icon in de 'Wallpaper changer' (ook overigens een mooi VB programma) [url]http://www.freevbcode.com/ShowCode.Asp?ID=3113[/url] Quote Link naar reactie
anoniem Geplaatst: 8 september 2003 Auteur Delen Geplaatst: 8 september 2003 Zet onderstaande code in een module: [code:1:b392a99daa] 'user defined type required by Shell_NotifyIcon 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 'Button down Public Const WM_LBUTTONUP = &H202 'Button up Public Const WM_LBUTTONDBLCLK = &H203 'Double-click Public Const WM_RBUTTONDOWN = &H204 'Button down Public Const WM_RBUTTONUP = &H205 'Button up Public Const WM_RBUTTONDBLCLK = &H206 'Double-click 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[/code:1:b392a99daa] En deze code in de mainforum. De form die weer zichtbaar moet worden na op het icoontje geklikt te hebben. [code:1:b392a99daa] Private Sub Form_Load() 'the form must be fully visible before calling Shell_NotifyIcon Me.Show Me.Refresh With nid .cbSize = Len(nid) .hwnd = Me.hwnd .uId = vbNull .uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE .uCallBackMessage = WM_MOUSEMOVE .hIcon = Me.Icon .szTip = "Your ToolTip" & vbNullChar End With Shell_NotifyIcon NIM_ADD, nid End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As _ Single, Y As Single) 'this procedure receives the callbacks from the System Tray icon. Dim Result As Long Dim msg As Long 'the value of X will vary depending upon the scalemode setting If Me.ScaleMode = vbPixels Then msg = X Else msg = X / Screen.TwipsPerPixelX End If Select Case msg Case WM_LBUTTONUP '514 restore form window Me.WindowState = vbNormal Result = SetForegroundWindow(Me.hwnd) Me.Show Case WM_LBUTTONDBLCLK '515 restore form window Me.WindowState = vbNormal Result = SetForegroundWindow(Me.hwnd) Me.Show ' Case WM_RBUTTONUP '517 display popup menu ' Result = SetForegroundWindow(Me.hwnd) ' Me.PopupMenu Me.mPopupSys End Select End Sub Private Sub Form_Resize() 'this is necessary to assure that the minimized window is hidden If Me.WindowState = vbMinimized Then Me.Hide End Sub Private Sub Form_Unload(Cancel As Integer) 'this removes the icon from the system tray Shell_NotifyIcon NIM_DELETE, nid End Sub Private Sub mPopExit_Click() 'called when user clicks the popup menu Exit command Unload Me End Sub Private Sub mPopRestore_Click() 'called when the user clicks the popup menu Restore command Me.WindowState = vbNormal Result = SetForegroundWindow(Me.hwnd) Me.Show End Sub[/code:1:b392a99daa] Deze code komt bijna letterlijk van een vbsite. Welke weet ik niet meer. Quote Link naar reactie
Aanbevolen berichten
Om een reactie te plaatsen, moet je eerst inloggen