[Mono-list] Why do .net compiled apps run without a black dos prompt, and mono apps do?
Jacob Rhoden
jacob at rhoden.id.au
Tue Jun 26 01:51:24 EDT 2007
Hi Guys, Not sure if this list is active, I just subscribed, anyways
quick question.
Why do .net compiled apps run without a black dos prompt, and mono apps do?
Long version:
1) I downloaded a simple example app to show an icon in the system tray.
I just dobule click on the executable and it works (runs under .NET not
mono).
2) then I compiled using mono, and then double click on the executable,
and a Black dos prompt opens and stays open during the life of the
application.
How do I compile so that I dont get the dos prompt? I tried compiling in
two different ways. I don't know the difference.
mcs /r:System.Windows.Forms.dll /r:System.Drawing.dll SystemTrayApp.cs
mcs -pkg:dotnet SystemTrayApp.cs
Here is the very simple code:
----------------------------------------------------
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;
namespace SystemTrayApp {
public class App {
private NotifyIcon appIcon = new NotifyIcon();
private ContextMenu sysTrayMenu = new ContextMenu();
private MenuItem exitApp = new MenuItem("Exit");
public void Start() {
// Configure the system tray icon.
Icon ico = new Icon("icon.ico");
appIcon.Icon = ico;
appIcon.Text = "My .NET Application";
sysTrayMenu.MenuItems.Add(exitApp);
appIcon.ContextMenu = sysTrayMenu;
appIcon.Visible = true;
exitApp.Click += new EventHandler(ExitApp);
}
private void ExitApp(object sender, System.EventArgs e) {
Application.Exit();
}
public static void Main() {
App app = new App();
app.Start();
Application.Run();
}
}
}
--
_________________________________________________
Jacob Rhoden
Application Architect
Systems Development and Integration
University of Melbourne
Phone: +61 3 8344 2884
More information about the Mono-list
mailing list