In the form's properties I set ...
Opacity = 0%
ShowInTaskbar = False
Size = 0,0

Signature
-- Thom Little -- www.tlanet.net -- Thom Little Associates, Ltd.
--
> Hi,
>
[quoted text clipped - 6 lines]
> thanks
> Ron
>Hi,
>
[quoted text clipped - 6 lines]
>thanks
>Ron
Ron, you don't need a main form at all in a WinForms app. Make a new
WinForms app, delete the form, and try this pseudo-code. You will need
to supply your own icon, menu etc., this won't compile out of the box
but should give you an idea of what is needed.
static class Program {
private static NotifyIcon m_Notify;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
// We don't need a form in order to create a notify icon.
m_Notify = new NotifyIcon();
m_Notify.Text = "Click me!";
// Must have an icon else we won't appear.
m_Notify.Icon = Properties.Resources.RonsIconHere;
// Handling a click is easy...
m_Notify.Click += new EventHandler(m_Notify_Click);
// Or a context menu...
//BuildContextMenu();
m_Notify.Visible = true;
// Start the windows message pump. The application will continue
// to run until Windows shuts down or your application is exited
// (you must provide the user with a way to do that).
Application.Run();
}
}
--
Philip Daniels
Ron M. Newman - 27 Aug 2006 17:54 GMT
Hi - thanks, this makes much more sense.
One question though, how do I "quit" from an application like this? where do
I inject the "exit" command if I have no main form to "Close()"
Let's say I had an event handler for double clicking the tray icon, I know
how to respond to that -- how do I close the app from there?
ron
>>Hi,
>>
[quoted text clipped - 48 lines]
> --
> Philip Daniels
Philip Daniels - 27 Aug 2006 18:38 GMT
>Hi - thanks, this makes much more sense.
>
[quoted text clipped - 5 lines]
>
>ron
Try this (rarely used from WinForms, but should do the job here):
Environment.Exit(0);
--
Philip Daniels
Chris Dunaway - 30 Aug 2006 21:27 GMT
> Try this (rarely used from WinForms, but should do the job here):
>
> Environment.Exit(0);
Actually, Application.Exit or Application.ExitThread might be more
appropriate.