prgramming a windows service
Posted
by xarzu
on Stack Overflow
See other posts from Stack Overflow
or by xarzu
Published on 2010-04-15T22:48:57Z
Indexed on
2010/04/15
22:53 UTC
Read the original article
Hit count: 384
I have started prgramming a windows service. I have added a notify icon from the toolbox. It has the small notify icon that appears in the systray as a member of those icons.
It works so far.
So far I have a blank form. I have used the DoubleClick for the notifyIcon to bring up the form (I will use the form for something later).
Now I have a list of things I want to accomplish to make this work like a true windows service.
First of all, if possible, I owuld like to remove the maximize and cancel button on the form.
Most windos service apps that I have seen offer the ability to close the app by right-mouse-button
clicking on the notify icon which brings up a menu of options.
I see in the properties of the form under Misc there is an CancelButton. But I
do not see how do deactivate it. In the Properties of the forum I see under Window Style
there is a ControlBox option that, if I turn to false, all three buttons, (minimize,
maximize and cancel) go away.
These are not what i am looking for. I would not like the option for them to resize,
maximize or close the form here. I suspect people will close the box intending to
make the box go away while still wanting the app to run.
Under the "Focus" caption in Properties, there id "Deactivate". I have created my own
event/method/function for this and in debug I noticed that when you click on the x-box in the
upper right corner, this function is called. The problem is that after the function is
over, the app closes anyway. How do I over-ride this function?
Secondly, how do you catch the right button click event on the notify icon in the
systray?
I can see how to create events for "Click" and "MouseClick" etc. but how so I determine
which button was click?
Using the right buton click is how such programs know when to pull up a menu. So I would
like to know how to do this as well.
© Stack Overflow or respective owner