[Mono-list] Re: [Gtk-sharp-list] Dos window - when launch app
onWin32 OS - how to remove it ?
Chris Aitken
chris at ion-dreams.com
Fri Jul 15 04:59:46 EDT 2005
> > > I just started using GTK# with mono and was happy that a small
> > > little app worked on my linux OS.
> > > I moved it to Win2000 and ran it (after installing gtk#
> runtime) and
> > > it works!!! but it brings up a dos window (cmd window?)
> as well as
> > > my GUI window.
> > > I don't use Windows to often, but i have to check to make
> sure what
> > > I create in mono/gtk# that I run on Linux, will run on Windows ...
> > > I remember something about setting an app to run via console in a
> > > older Win OS but I don't see that as an option under
> properties on
> > > Win2000 (on the app icon on desktop), so is the cmd
> console coming
> > > up by default via gtk#/mono? and if so, how can i get rid
> of it? I
> > > thought it might be coming up as a result of some
> Console.write's so
> > > i nuked them, so nothing is going out to STDOUT, but it
> didn't change it, the cmd console still pops up in addition
> to my GUI app.
> > > Anyone know how to stop this?
> >
> >
> > build your executable with /target:winexe instead of /target:exe
>
> Todd,
>
> Maybe I'm wrong but on windows installation it isn't posible
> to disable dos command box while starting mono application.
>
> Even setting /target:winexe. On Linux station, this works
> ---well actually on linux station a console never is showed
> while starting any
> application--- but on windows, /target option only disables
> that the dos box opened doesn't write out info to the
> console. However it keeps on getting showed.
>
> It would be great to ear someone who have managed to disable
> this dos box on windows platforms.
I have run a simple S.W.F hello.cs (code at bottom).
If compiled in Linux as
$mcs hello.cs -target:winexe -r:System,System.Windows.Forms,System.Drawing
I do not get a dos window open. If I leave off the -target, the window
appears. Obviously this isnt gtk#, but it shows that the -target:winexe
works to some extent.
Chris
//
// Hello, SWF!
//
//
// This application will produce a window 250x250 pixels in size
// It will display "My first System.Windows.Forms application(TM)" centered
in it
using System;
using System.Drawing;
using System.Windows.Forms;
namespace MWFTestApplication {
class MainWindow : System.Windows.Forms.Form {
public MainWindow() {
Label label;
ClientSize = new System.Drawing.Size (250, 250);
label = new Label();
label.Text = "My first System.Windows.Forms
application(TM)";
label.Dock = DockStyle.Fill;
label.TextAlign = ContentAlignment.MiddleCenter;
this.Controls.Add(label);
Text = "Hello, System.Windows.Forms";
}
public static void Main(string[] args) {
Application.Run(new MainWindow());
}
}
}
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the Mono-list
mailing list