Valhalla Legends Archive

Programming => General Programming => Topic started by: OcTaViuS on April 19, 2003, 03:37 PM

Title: how do you minimize to the system tray? (VB)
Post by: OcTaViuS on April 19, 2003, 03:37 PM
ive searched all over the forums, and while finding threads about this topic, none of them really explained how to do it.

one code example was the way to just minimize it to the taskbar

WindowState = vbMinimized

but i already knew that  :-\

so can someone explain how to actually get it to minimize so the icon's in the sytem tray, i can't figure it out, i feel so stupid  :'(
Title: Re:how do you minimize to the system tray? (VB)
Post by: Skywing on April 19, 2003, 03:55 PM
Quote from: OcTaViuS on April 19, 2003, 03:37 PM
ive searched all over the forums, and while finding threads about this topic, none of them really explained how to do it.

one code example was the way to just minimize it to the taskbar

WindowState = vbMinimized

but i already knew that  :-\

so can someone explain how to actually get it to minimize so the icon's in the sytem tray, i can't figure it out, i feel so stupid  :'(
"Minimizing to the system tray" just means that you hide the window and create a tray icon, which has been covered.  This might clear up some confusion...
Title: Re:how do you minimize to the system tray? (VB)
Post by: OcTaViuS on April 19, 2003, 06:13 PM
oooo k that did clear it up a bit

i got the window hiding thing down, but how do u put the icon in the system tray?
Title: Re:how do you minimize to the system tray? (VB)
Post by: Grok on April 19, 2003, 06:21 PM
You search the forums for 'system tray'.
Title: Re:how do you minimize to the system tray? (VB)
Post by: OcTaViuS on April 19, 2003, 06:38 PM
heh thanks :-\ turns out when i searched b4 posting this thread i didnt search far enough back, i had to extend the max age of post thing. i got it now thanks guys.
Title: Re:how do you minimize to the system tray? (VB)
Post by: Dayclone on April 19, 2003, 07:44 PM
heres the code

Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long

   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 nid As NOTIFYICONDATA
Title: Re:how do you minimize to the system tray? (VB)
Post by: haZe on April 20, 2003, 06:17 AM
Those are just declares.