minimizing console window on startup

G

Guest

Hi everyone,

I have a c# console app that when run through an autorun.inf file, launches
a web page from the CD. It works just fine but I would like the console
window minimized on startup. Currently, the console window displays briefly,
the web page loads, and the console window disappears.

The only line of code currently in the console app is...
System.Diagnostics.Process.Start("blahblahblah.htm")

Any suggestions?

Thanks,
Scott
 
I

Ian C

Scott said:
Hi everyone,

I have a c# console app that when run through an autorun.inf file, launches
a web page from the CD. It works just fine but I would like the console
window minimized on startup. Currently, the console window displays briefly,
the web page loads, and the console window disappears.

The only line of code currently in the console app is...
System.Diagnostics.Process.Start("blahblahblah.htm")

Any suggestions?

Don't know if this will work offhand, but couldn't you just have a GUI
app that doesn't create a form? It just does the Start() then returns.
Thanks,
Scott

HTH


Ian C
 
G

Guest

Thanks, Ian.

I tried creating a windows form app (but didn't hide it) to see what would
happen. The form loads, the web page is loaded but after closing the web
page, the winform app remains open. I'm not sure how to handle that.
Otherwise, I'm sure a winform could be hidden.

Scott
 
I

Ian C

Scott said:
Thanks, Ian.

I tried creating a windows form app (but didn't hide it) to see what would
happen. The form loads, the web page is loaded but after closing the web
page, the winform app remains open. I'm not sure how to handle that.
Otherwise, I'm sure a winform could be hidden.

Hello Scott

I don't have access to Visual Studio as I'm working in UNIX land at the
minute (well, don't have access to it anywhere!), but what I meant was
have no form at all.

For instance put this in launch.cs:

using System;
using System.Diagnostics;

namespace Launch
{
class Launch
{
static public void Main(string[] args)
{
Process.Start("test.html");
}
}
}

Then just try compiling it with:

csc /t:winexe launch.cs

I then ran it with a double click, and no console window.

In short, a GUI app doesn't need to go anywhere near a Forms object. I
seem to remember that being a GUI app just means the OS won't create a
console for you...


Ian C
 
G

Guest

got it now! Thanks, Ian, that was a great tip. And now, no more annoying
console window popping up or form to worry about hiding/minimizing.

Scott

Ian C said:
Scott said:
Thanks, Ian.

I tried creating a windows form app (but didn't hide it) to see what would
happen. The form loads, the web page is loaded but after closing the web
page, the winform app remains open. I'm not sure how to handle that.
Otherwise, I'm sure a winform could be hidden.

Hello Scott

I don't have access to Visual Studio as I'm working in UNIX land at the
minute (well, don't have access to it anywhere!), but what I meant was
have no form at all.

For instance put this in launch.cs:

using System;
using System.Diagnostics;

namespace Launch
{
class Launch
{
static public void Main(string[] args)
{
Process.Start("test.html");
}
}
}

Then just try compiling it with:

csc /t:winexe launch.cs

I then ran it with a double click, and no console window.

In short, a GUI app doesn't need to go anywhere near a Forms object. I
seem to remember that being a GUI app just means the OS won't create a
console for you...


Ian C
 
I

Ian C

Scott said:
got it now! Thanks, Ian, that was a great tip. And now, no more annoying
console window popping up or form to worry about hiding/minimizing.

You're welcome Scott. I only wandered in here by mistake from
comp.lang.c :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top