By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,837 Members | 1,665 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,837 IT Pros & Developers. It's quick & easy.

minimizing console window on startup

P: n/a
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
May 25 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a

Scott wrote:
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

May 25 '06 #2

P: n/a
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

"Ian C" wrote:

Scott wrote:
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

May 25 '06 #3

P: n/a
Scott wrote:
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...
Scott

Ian C

May 25 '06 #4

P: n/a
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" wrote:
Scott wrote:
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...
Scott

Ian C

May 25 '06 #5

P: n/a

Scott wrote:
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 :-)

May 26 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.