Click to See Complete Forum and Search --> : System Tray
Payal77
September 26th, 2001, 03:46 PM
I wanted to have an application run in the System Tray. This application is a Visual basic exe and I want it to be residing in the System Tray. I searched the net and couldn't find anything related to it. I could find many articles that showed how to display an icon in the System Tray, but I was wondering how to reside the whole application in the System Tray?
The Shell_NotifyIcon API function can create an icon in the system tray, is there any API function that would reside the whole application in the System Tray?
Any help would be greatly appreciated.
DSJ
September 26th, 2001, 03:58 PM
there's a free systray.ocx that'll do it for you at http://ebed.virtualave.net
John G Duffy
September 26th, 2001, 06:09 PM
The articles you speak of putting a Icon in the System Tray are what you are looking for. You incorporate the sample code supplied with the article with the code of your application. Then you create your .exe file
John G
Clearcode
September 27th, 2001, 07:03 AM
Having created an icon in the system tray you need to set your application's main form's ShowIntaskbar member to false to prevent it being shown in the taskbar as well.
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
vickiyoull
September 27th, 2001, 07:24 AM
test
Payal77
September 27th, 2001, 08:55 AM
I can display the icon in the System Tray, the source code is attached herewith. I don't know how to use it to display the whole form? I have created a form Tray.frm and a module Tray.bas. I am confused as to how to make the iconFileName equal to a form or something else instead of ICON1 as mentioned below.
Tray.bas
option Explicit
' The API function declaration.
public Declare Function Shell_NotifyIcon _
Lib "shell32.dll" _
Alias "Shell_NotifyIconA" _
(byval dwMessage as Long, _
lpData as NOTIFYICONDATA) as Long
'Data type for icon data.
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
'The icon.
Global Const ICON1 = "books01.ico"
Global iconData as NOTIFYICONDATA
Global iconFileName as string
Global Const NIM_ADD = &H0
Global Const NIM_MODIFY = &H1
Global Const NIM_DELETE = &H2
Global Const NIF_MESSAGE = &H1
Global Const NIF_ICON = &H2
Global Const NIF_TIP = &H4
Global Const WM_MOUSEMOVE = &H200
Global Const NIF_RBDOWN = 7740
Global Const NIF_LBDOWN = 7695
Tray.frm
private Sub Form_Load()
'Load the desired icon into the PictureBox.
iconFileName = ICON1
Picture1.Picture = LoadPicture(App.Path & "\" & iconFileName)
'set up the NOTIFYICONDATA structure.
iconData.cbSize = len(iconData)
iconData.hWnd = Picture1.hWnd
iconData.uID = 1&
iconData.uFlags = NIF_MESSAGE Or NIF_ICON Or NIF_TIP
iconData.uCallbackMessage = WM_MOUSEMOVE
iconData.hIcon = Picture1.Picture
iconData.szTip = "Tray Icon Demo" & Chr$(0)
'Display the icon in the tray.
Shell_NotifyIcon NIM_ADD, iconData
End Sub
private Sub mnuExit_Click()
'Remove the icon from the tray and end the program.
Shell_NotifyIcon NIM_DELETE, iconData
End
End Sub
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.