|
-
Mar 26th, 2006, 01:42 AM
#1
Thread Starter
Hyperactive Member
Notify Icon for console Application.
I have a console application in C# and i would like to have a notify icon.
Have yet to find an example for it. searched google for "Status Tray Icon for C# console application". ... among others. eg "Console Application Notify Icon forC# ."
Help is much apperciated.
Without balance, there could only be chaos.
Without chaos, there could be no balance.
I live with karma. Eat with destiny. Dream of life without shackles....
Yet. If life had no consequences, life could not exist, nor could it flourish.
If at first you dont succeed.You're screwed.
C++/Java NOOB.
I aint a professional at PHP, but if i can help i will.
-
Mar 26th, 2006, 03:38 AM
#2
Re: Notify Icon for console Application.
I believe the only way to do it is to add a reference to System.Windows.Forms and declare it as a System.Windows.Forms.NotifyIcon and ContextMenu..
Not exactly a console app once you hit the system tray though, is it 
Bill
-
Mar 26th, 2006, 05:08 AM
#3
Thread Starter
Hyperactive Member
Re: Notify Icon for console Application.
Yeah. Well...
I guess i could use winForm.
but i really didnt wana.
Also i thought you could use a notify icon with console app's.. at least thats what i've seen done.
Without balance, there could only be chaos.
Without chaos, there could be no balance.
I live with karma. Eat with destiny. Dream of life without shackles....
Yet. If life had no consequences, life could not exist, nor could it flourish.
If at first you dont succeed.You're screwed.
C++/Java NOOB.
I aint a professional at PHP, but if i can help i will.
-
Mar 26th, 2006, 11:36 AM
#4
Re: Notify Icon for console Application.
 Originally Posted by PlaGuE
...... at least thats what i've seen done.
Are you sure those apps aren't using any hidden form ?
What i guess from my VB6 experience is, it is impossible to do without a form (window).
My guess is, the .NET framework relies on Win32 API (Shell_NotifyIcon) to display the tray icon. The api expects a NOTIFYICONDATA structure from where it gets a window handle and a callback message to use.
Then, the original window receives the events we perform on trayicon in it's default winproc via that callback message.
VB Code:
' [b]The NOTIFYICONDATA Structure[/b]
Private Type NOTIFYICONDATA
cbSize As Long
hWnd As Long ' It is needed
uId As Long
uFlags As Long
ucallbackMessage As Long
hIcon As Long
szTip As String * 64
End Type
Last edited by iPrank; Mar 26th, 2006 at 11:43 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|