473,379 Members | 1,184 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

NotifyIcon.DoubleClick/.Click doesn't work in Console App

Hi everyone...

I'm a starter at .Net programming, and I need some help.

I was asked to develop a console app that will auto-hide the console window and show a system tray icon.

And by default, the system tray icon on click is supposed to show the console window

I know window apps are usually the better solution for handling NotifyIcon class, but I would really like to know how to do it in console apps

here are my codes:

'declaring the object
Dim WithEvents NotifyIcon1 As New NotifyIcon

'initializing
NotifyIcon1.Icon = New System.Drawing.Icon("C:\Documents and Settings\achan\My Documents\Icon.ico")

'setting icon to visible on execute
NotifyIcon1.Visible = True

'adding event handler
AddHandler NotifyIcon1.DoubleClick, AddressOf NotifyIcon_DoubleClick

'method to be executed on event
Private Sub NotifyIcon_DoubleClick(ByVal source As Object, ByVal e As EventArgs) Handles NotifyIcon1.Click
If NotifyIcon1.Visible = True Then
ShowWindow(winHandle, SHOW_WINDOW.SW_NORMAL)
NotifyIcon1.Visible = False

Else
ShowWindow(winHandle, SHOW_WINDOW.SW_HIDE)
NotifyIcon1.Visible = True
End If
End Sub

Basically.. that's all for what I have regarding the NotifyIcon classes. In this case, my ShowWindow method is working nicely, so I have absolutely no idea how to solve the problem.

Also, I tried using the MouseEventsArgs but it doesn't work. No matter what I do with the NotifyIcon, it doesn't respond on any mouse clicks.

Any and all help will be very much appreciated.


Please pardon me if this was posted at the wrong forum
Apr 2 '07 #1
5 2877
kenobewan
4,871 Expert 4TB
Welcome to the site. Here is a thread that may help:
datagrid event
Apr 2 '07 #2
Hi... Thanks for the link, but it's not helping.

Basically... the system tray icon just ends up being a static icon. I can't show the console window when the user clicks.
Apr 3 '07 #3
Motoma
3,237 Expert 2GB
Hi... Thanks for the link, but it's not helping.

Basically... the system tray icon just ends up being a static icon. I can't show the console window when the user clicks.
Is the NotifyIcon_DoubleClick sub being called?
Apr 3 '07 #4
Is the NotifyIcon_DoubleClick sub being called?

Expand|Select|Wrap|Line Numbers
  1. 'adding event handler
  2. AddHandler NotifyIcon1.DoubleClick, AddressOf NotifyIcon_DoubleClick
Hi... Thanks for replying. Really appreciate it. I added an event handler, and thought it will call the NotifyIcon_DoubleClick method on double clicking the icon. Did I miss something out?
Apr 3 '07 #5
Motoma
3,237 Expert 2GB
Expand|Select|Wrap|Line Numbers
  1. 'adding event handler
  2. AddHandler NotifyIcon1.DoubleClick, AddressOf NotifyIcon_DoubleClick
Hi... Thanks for replying. Really appreciate it. I added an event handler, and thought it will call the NotifyIcon_DoubleClick method on double clicking the icon. Did I miss something out?
Yes, it looks like that should happen, but is it?
Try tracing through your code, or adding a popup box inside the subroutine.
Apr 3 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: petterl | last post by:
I have tried to find the error in the code below but I always get " An unhandled exception of type 'System.NullReferenceException' occurred in Unknown Module. Additional information: Object...
3
by: ThunderMusic | last post by:
Hi, I'm trying to have a MSN Messenger like form/app closing behavior. When I click on the X button, I only want the form to disappear and when I double-click on the notify icon or right-click...
2
by: Rob Mayo | last post by:
OK, maybe this is my opinion, maybe these are bugs. Given the folowing: I have a NotifyIcon on my Form, a Context menu associated with the NotifyIcon, and a MenuItem on the ContextMenu set as...
0
by: Mike Allen | last post by:
Hi Everyone, My problem concerns ContextMenus. It's easy enough to create one and apply it to a NotifyIcon. When it's compiled and run, it works beautifully. Right click and there you are. But I...
2
by: Heather R | last post by:
I am writing a windows service that has a notifyicon component. The component displays accordingly, but for some reason, I cannot get the click or double click event to fire. It seems like none of...
3
by: C Glenn | last post by:
I would like one DoubleClick event handler to handle all double clicks throughout a DataGrid. I've assigned a DoubleClick event handler to the DataGrid and it works nifty-spiffy so long as I click...
3
by: SteveMac | last post by:
I am using VS2003 VC++ .NET. I want to make a tray icon with a popup menu (like a context menu) that pops up for a left click. I can make the notifyicon with a context menu and that works fine,...
1
by: Marcel Brekelmans | last post by:
Hello, I have implemented a NotiFyIcon and am using both DoubleClick and Click events. But the Doubleclick action on my icon also fires the Click event. Am I missing some setting somewhere or is...
1
by: \Ji Zhou [MSFT]\ | last post by:
Hello Jason, Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou and I will be working on this issue with you. I have tried to but cannot reproduce your issue on my side....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.