Systray is not a standard VB control. There are several commercial systray controls (search on Google for systray) and a Microsoft VB4 sample code, written in VB.
Techaspirer,
If you post code using non-standard controls, it's usuall worth noting which controls you're talking about, and where they come from. Let me know if this helps
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
Hey
sorry ya. actually i have a separate OCX file for systray. how do i upload that in this forum. if therez any way juz tell me. or i can also email u this file. its kust 36.2 KB.
Hey actually i used this for my project Folder security. this worked for me well. juz make a try. i hope this works out well. then... in ur project you'll find icon property. juz give the path of the icon which needs to be placed for your priject.
Hope I'm clear...if u have some prob..tell me..i'll try it once again.
The code goes here!!!
*******
'To Display Icon on the task bar while runtime
'An API call to inform the Shell for displaying the icon at taskbar
Private Declare Function Shell_NotifyIcon Lib "SHELL32" _
Alias "Shell_NotifyIconA" _
(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
Private abd As NOTIFYICONDATA
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 Sub Form_Load()
On Error Resume Next
Dir1.Path = "c:\"
With abd
.cbSize = Len(abd)
.hwnd = Me.hwnd
.uId = vbNull
.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
.uCallBackMessage = Mouse_Move
.hIcon = Me.Icon
.szTip = "Your project name u r runnning" & vbNullChar
End With
Shell_NotifyIcon NIM_ADD, abd
Me.Hide
End Sub
I don't know about anyone else, but I can an error saying "Dir1 is undefined". Looking at the code, it's not declared. Is it not supposed to be? What could be causeing this error? -Ovatvvon :-Q
This code has to be in a seperate ocx file? Honestly, as I'm sure it's apparent, I'm still learning. Could you give me a quick overview of what ocs files are and how to create them or how to attach them to the regular vb application? I don't need an in-depth explaination. Just enough to get me started and I'll explore from there. -Ovatvvon :-Q
Let me know if this helps
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
well, we're not supposed to post our email addresses in the forums. However the code for the ocx file is above, right?
How would I make the ocx file with that code. Just put it in a form of it's own? And then, once I create the ocx form, how would I call it from the main program so it will place the icon in the system tray?
after u sign in there u'll find "files" link on the left side. there u'll find a file systray.ocx. downlaod that.all i can do is this.if u have doubts stilll feel free to ask me.
1. open ur project
2. goto Project- components
3. click browse and locate ur ocx file
4. then its get added up in your proj tooolbar.
5. click that icon and drag it to ur project form.
6. change its name to systray1 in properties box
7. u r now done and add the following code.
'Put this code in form load event
Set SysTray1.Picture = LoadPicture(app.path "&" "\View.ico"
SysTray1.Add
Me.hide
'then continue with your later part of the code here.
But now there's a different problem. When the program is hidden, I wanted the tray icon to appear so the user could double click on that and have the program re-appear. That way the administrator could shut down the program if need be.
Is there a way to make it so the user can click on the icon and have it show the program again? Does that have to be done in the ocx file? -Ovatvvon :-Q
fine...nice to hear. Create a menu using menu editor which contain "hide" and "show" menu. Then during form load make that menu editor invisible.
then write an event like this:
Private Sub SysTray1_LeftDblClick()
PopupMenu test1
' here popmenu is the key word and 'test1' is the menu editor name
End Sub
'then write a code for show and hide.
show_click()
me.show
hide_click()
me.hide
Here show and hide are the event name in menu editor.
Hope i'm clear....
if u want i can send u the file wht i have. i'll post in the same yahoo gp written above if u need that.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.