System Tray Help Please

B

BJ

I am trying to add my application to the system tray. I am
not using the built in control becuase of the limitation
that you can not use the balloon tool tip feature. I have
done this succesfully in vb6 but when I try it in vb.net I
get the system tray to work but there is no icon in the
system tray. I know it is working because I can get the
balloon tip to appear and where the icon is supposed to be
there just isn't an icon. just a blank space. I am going
nuts as to why I can't get an icon to show up. Plus how do
I handle the user clicking on the icon? In vb 6 I used to
put .uCallbackMessage = WM_MOUSEMOVE in the NOTIFYICONDATA
data structure...now this does not work. And neither does
popUpMenu. I am really curious as to why this was so easy
in vb6 but now it is almost impossible to do in vb.net.
Btw just to test I have used the built in control and my
icon adds to the taskbar that way. Can anyone help me out
please. Here is my code

With uNIF
.cbSize = Marshal.SizeOf(uNIF)
.hwnd = Me.Handle
.uID = 1
.dwInfoFlags = NIF_ICON Or NIF_MESSAGE
.uCallbackMessage = New IntPtr(&H500) <-- WHAT
SHOULD GO HERE?
.uVersion = NOTIFYICON_VERSION
.hIcon = Me.Icon.Handle <-- DOES NOT WORK
End With
Result = Shell_NotifyIcon(NIM_ADD, uNIF)
With uNIF
.uFlags = NIF_INFO
.uVersion = 2000
.szInfoTitle = "Test"
.szInfo = "Testing 1,2,3 Testing"
.dwInfoFlags = NIIF_INFO
End With
Result = Shell_NotifyIcon(NIM_MODIFY, uNIF)

Thanks in advance.

BJ
 
C

Chris Dunaway

These are all for C#. Is there anything for VB.NET???

Thanks again.

There may be on CodeProject, but I didn't really look for them. I just
thought that those would give you some hint. I think one of them is a
control, so you can just reference it in your project and use it (I may be
wrong about that, however).

You can also try this one. It's not strictly a NotifyIcon, but you may be
able to use it. Also C# but a full control that you can call from VB.Net.
It has a VB.Net project included.
 
C

Chuck

I used to do the same thing in VB6. In .NET use the
NotifyIcon component (under Window Forms in the toolbox).
You can set the Icon property to the desired icon and the
Text property to the desired tooltip. There are events
for Click, DoubleClick, MouseDown, MouseOver, and MouseUp.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top