473,490 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Keeping application to notify icon

I want to start my application so that its notify icon is added to the
system tray, i don't want to show any starting form. I want user to interact
through the notify icon...just like MSN. Is there any way to do this?
regards,
beenish
Nov 16 '05 #1
4 9919
hi,

find below pieces of code I use for this

//declarations

[DllImport("user32.dll",EntryPoint="SetForegroundWi ndow")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern int SetWindowLong( IntPtr window, int index, int
value);
[DllImport("user32.dll")]
public static extern int GetWindowLong( IntPtr window, int index);

const int GWL_EXSTYLE = -20;
const int WS_EX_TOOLWINDOW = 0x00000080;
const int WS_EX_APPWINDOW = 0x00040000;
//PUT THIS code in the constructor
this.Text = "";

// Create the NotifyIcon.
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);

// The Icon property sets the icon that will appear
// in the systray for this application.
notifyIcon1.Icon = normalIcon;
notifyIcon1.Visible = true;

this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.Visible = false;
this.ShowInTaskbar = false;
iconTimer.Start();

int windowStyle = GetWindowLong(Handle, GWL_EXSTYLE);
SetWindowLong(Handle, GWL_EXSTYLE, windowStyle | WS_EX_TOOLWINDOW);
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Beenish Sahar Khan" <be**********@kolachi.net> wrote in message
news:es*************@tk2msftngp13.phx.gbl...
I want to start my application so that its notify icon is added to the
system tray, i don't want to show any starting form. I want user to
interact
through the notify icon...just like MSN. Is there any way to do this?
regards,
beenish

Nov 16 '05 #2
Thanks alot, its working :D

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:%2****************@tk2msftngp13.phx.gbl...
hi,

find below pieces of code I use for this

//declarations

[DllImport("user32.dll",EntryPoint="SetForegroundWi ndow")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern int SetWindowLong( IntPtr window, int index, int
value);
[DllImport("user32.dll")]
public static extern int GetWindowLong( IntPtr window, int index);

const int GWL_EXSTYLE = -20;
const int WS_EX_TOOLWINDOW = 0x00000080;
const int WS_EX_APPWINDOW = 0x00040000;
//PUT THIS code in the constructor
this.Text = "";

// Create the NotifyIcon.
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
// The Icon property sets the icon that will appear
// in the systray for this application.
notifyIcon1.Icon = normalIcon;
notifyIcon1.Visible = true;

this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.Visible = false;
this.ShowInTaskbar = false;
iconTimer.Start();

int windowStyle = GetWindowLong(Handle, GWL_EXSTYLE);
SetWindowLong(Handle, GWL_EXSTYLE, windowStyle | WS_EX_TOOLWINDOW);
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Beenish Sahar Khan" <be**********@kolachi.net> wrote in message
news:es*************@tk2msftngp13.phx.gbl...
I want to start my application so that its notify icon is added to the
system tray, i don't want to show any starting form. I want user to
interact
through the notify icon...just like MSN. Is there any way to do this?
regards,
beenish


Nov 16 '05 #3
Thanks for your solution, one more question that i would like to ask is ,
once i've made my form invisble using the below mentioned solution, now
after sometime, while the application is still running, i want to make the
particular form visible, what should i do to make it visible.
Beenish
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:%2****************@tk2msftngp13.phx.gbl...
hi,

find below pieces of code I use for this

//declarations

[DllImport("user32.dll",EntryPoint="SetForegroundWi ndow")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern int SetWindowLong( IntPtr window, int index, int
value);
[DllImport("user32.dll")]
public static extern int GetWindowLong( IntPtr window, int index);

const int GWL_EXSTYLE = -20;
const int WS_EX_TOOLWINDOW = 0x00000080;
const int WS_EX_APPWINDOW = 0x00040000;
//PUT THIS code in the constructor
this.Text = "";

// Create the NotifyIcon.
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
// The Icon property sets the icon that will appear
// in the systray for this application.
notifyIcon1.Icon = normalIcon;
notifyIcon1.Visible = true;

this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.Visible = false;
this.ShowInTaskbar = false;
iconTimer.Start();

int windowStyle = GetWindowLong(Handle, GWL_EXSTYLE);
SetWindowLong(Handle, GWL_EXSTYLE, windowStyle | WS_EX_TOOLWINDOW);
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Beenish Sahar Khan" <be**********@kolachi.net> wrote in message
news:es*************@tk2msftngp13.phx.gbl...
I want to start my application so that its notify icon is added to the
system tray, i don't want to show any starting form. I want user to
interact
through the notify icon...just like MSN. Is there any way to do this?
regards,
beenish


Nov 16 '05 #4
Infact, i will rephrase my question that while running my application i
would like to hide it or show it multiple times, how do i show it so when
the next time i try to hide it, it will hide cleanly. as currently if i
simple make it visible and show it in taskbar, it do not hide again. :( I
request you to provide me a solution to this problem.
regards,
Beenish
"Beenish Sahar Khan" <be**********@kolachi.net> wrote in message
news:uA*************@TK2MSFTNGP12.phx.gbl...
Thanks for your solution, one more question that i would like to ask is ,
once i've made my form invisble using the below mentioned solution, now
after sometime, while the application is still running, i want to make the particular form visible, what should i do to make it visible.
Beenish
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote in message news:%2****************@tk2msftngp13.phx.gbl...
hi,

find below pieces of code I use for this

//declarations

[DllImport("user32.dll",EntryPoint="SetForegroundWi ndow")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern int SetWindowLong( IntPtr window, int index, int
value);
[DllImport("user32.dll")]
public static extern int GetWindowLong( IntPtr window, int index);

const int GWL_EXSTYLE = -20;
const int WS_EX_TOOLWINDOW = 0x00000080;
const int WS_EX_APPWINDOW = 0x00040000;
//PUT THIS code in the constructor
this.Text = "";

// Create the NotifyIcon.
this.notifyIcon1 = new

System.Windows.Forms.NotifyIcon(this.components);

// The Icon property sets the icon that will appear
// in the systray for this application.
notifyIcon1.Icon = normalIcon;
notifyIcon1.Visible = true;

this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.Visible = false;
this.ShowInTaskbar = false;
iconTimer.Start();

int windowStyle = GetWindowLong(Handle, GWL_EXSTYLE);
SetWindowLong(Handle, GWL_EXSTYLE, windowStyle | WS_EX_TOOLWINDOW);
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Beenish Sahar Khan" <be**********@kolachi.net> wrote in message
news:es*************@tk2msftngp13.phx.gbl...
I want to start my application so that its notify icon is added to the
system tray, i don't want to show any starting form. I want user to
interact
through the notify icon...just like MSN. Is there any way to do this?
regards,
beenish



Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
10271
by: Lalit | last post by:
Hi Friends, I have developed a Windows service. Now i need icon for this service in systray and context menu fo this icon. Can i do this? With regards, Lalit
3
6911
by: jm | last post by:
Hi, I have a C# program that changes the notifyIcon during the program. What I have noticed is that sometimes when the program is over the old icon will still be in the system tray. But when i...
3
351
by: Beenish Sahar Khan | last post by:
I am using C#.I want to start my application so that its notify icon is added to the system tray, i don't want to show any starting form. I want user to interact through the notify icon...just...
3
1753
by: Ravi Shankar | last post by:
Hi, I have a windows form application it uses AxShDocVw AxWebBrowser control. The control navigates to web pages at a specified interval set in Timer control. The form uses a notify icon. On...
6
2587
by: Neo | last post by:
i'd like to create an application which would run in the background, & there'd be an icon in the system tray (can use the notify icon). But HOW can i make the form invisible. What i'd like to do...
0
1376
by: Mike Eaton | last post by:
Hi there, I have an app whose structure is as follows: a module calls a custom application context containing a notify icon and associated context menu, which in turn acts upon an instance of...
3
1996
by: Cylix | last post by:
I am going to make an application in monitor and do something on time. A part of it is an Notify icon(System Tray Icon), Which project type can I be used for Just showing the notify icon without...
5
15436
by: =?Utf-8?B?cHJvZ2dlcg==?= | last post by:
I've written an application that can minimize to the tray and can reappear if you double click on the icon in the tray (ShowInTaskbar is set to false). I've also created a ContextMenuStrip (Visual...
1
1603
by: namrataa | last post by:
i have a notify icon for our media player developed in wpf. included files are notify.cs,notify.resx,notify.designer.cs. i have also added a class file called app.cs . now the problem is how...
0
7142
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7181
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6847
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7352
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4875
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3078
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
618
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.