how would you make it so a program it in the bar on the bottom of the screen where the time is, and how would you make it so when you click on the X it minimizes down to there. Thnx
Printable View
how would you make it so a program it in the bar on the bottom of the screen where the time is, and how would you make it so when you click on the X it minimizes down to there. Thnx
VB Code:
Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean 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 Private Const NIM_ADD = &H0 Private Const NIM_MODIFY = &H1 Private Const NIM_DELETE = &H2 Private Const WM_MOUSEMOVE = &H200 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_LBUTTONUP = &H202 Private Const WM_RBUTTONDBLCLK = &H206 Private Const WM_RBUTTONDOWN = &H204 Private Const WM_RBUTTONUP = &H205 Private SysTray As NOTIFYICONDATA Private Sub StartInSysTray() SysTray.cbSize = Len(SysTray) SysTray.hwnd = Picture1.hwnd SysTray.uId = 1& SysTray.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE SysTray.ucallbackMessage = WM_MOUSEMOVE SysTray.hIcon = Me.Icon SysTray.szTip = "&R&e&s&t&a&r&t" & Chr$(0) Shell_NotifyIcon NIM_ADD, SysTray Me.Hide App.TaskVisible = False End Sub Private Sub Form_Load() StartInSysTray End Sub Private Sub Form_Unload(Cancel As Integer) SysTray.cbSize = Len(SysTray) SysTray.hwnd = Picture1.hwnd SysTray.uId = 1& Shell_NotifyIcon NIM_DELETE, SysTray End Sub 'Add A Picture Control To The Form. Set its visible property to False Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Static rec As Boolean, msg As Long Dim RetVal As String Dim returnstring Dim retvalue msg = X / Screen.TwipsPerPixelX If rec = False Then rec = True Select Case msg Case WM_LBUTTONDOWN Case WM_LBUTTONDBLCLK Case WM_LBUTTONUP Case WM_RBUTTONUP End Select rec = False End If End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Select Case UnloadMode Case vbFormControlMenu 'UnloadMode 0 'form is being unloaded via the X Me.Hide Case vbFormCode 'UnloadMode 1 'Unload Me has been issued from code Case vbAppWindows 'UnloadMode 2 'Windows itself is closing Case vbAppTaskManager 'UnloadMode 3 'the Task Manager is closing the app Case vbFormMDIForm 'UnloadMod 4 'an MDI child form is closing because 'its parent form is closing End Select End Sub