Formless application

  • Thread starter Thread starter Wayne
  • Start date Start date
W

Wayne

I need an application to start run it's process, and save a log as it goes,
it will be automated with a scheduled task and as such requires no
interface. I don't want to use a service as it only needs to run once or
twice a week.

How would one go about making an application with no interface at all?

--
Thanks
Wayne Sepega
Jacksonville, Fl


"When a man sits with a pretty girl for an hour, it seems like a minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein
 
How would one go about making an application with no interface at all?
Create an empty project, add a static Main-Method for startup
and set "Output Type" to Windows application.
 
Tricky problem as setting Visible to False or doing a
this.Hide() only work after the form has finished loading.

If you head on into your Main function and change
Application.Run(new YourStartupForm) to Application.Run(),
the form will be loaded in the background and still
be 'running', just not visibly (as far as the form is
concerned).

A quick tests to show this works would be throwing an
enabled timer onto the form that simply prints something
out to the console.

Brendan
 
My apologies, I goofed in my previous post. Prior to
calling Application.Run(), you need to create an instance
of your form, so your Main would end up looking something
like.

YourStartupForm foo = new YourStartupForm();
Application.Run();
 
Wayne,
make a windows service, it will run in the background and you will never see
it. You can also set CPU priority if it's something that want to run above
anything else.
 
Denny Britz suggested doing this a couple posts back:
Create an empty project, add a static Main-Method for startup
and set "Output Type" to Windows application.

So far it's been working great.

Wayne
 
Back
Top