Solved

running a app with no window or console in the background

Posted on 2008-10-20
8
1,227 Views
Last Modified: 2009-08-17
Is there an elegant way of running a background process without having a console or window?

i.e. not having something like a while true in main

Something tailor made for this perhaps, but not a windows service.
0
Comment
Question by:gustierng
  • 5
  • 3
8 Comments
 
LVL 6

Expert Comment

by:RishadanPort
ID: 22759517
One way, is simply create a C# method, goto the program.cs file, and remove the "Application.Run()" function, and in this function (the main method), add whatever you like
0
 

Author Comment

by:gustierng
ID: 22759538
what kind of application would you start with?
0
 

Author Comment

by:gustierng
ID: 22759742
Hi

I have tried to see what you have suggested but do not understand.  Please clarify.

thanks
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 6

Expert Comment

by:RishadanPort
ID: 22760291
>>Is there an elegant way of running a background process without having a console or window?
Why exactly are you trying to make a process that is not visible in a window or console? The only reason that I see is to make a process that is malicious. Could you clarify what you are trying to achieve with this process?

>>i.e. not having something like a while true in main
You could simply use threads which wait until they have a job to do
0
 
LVL 6

Accepted Solution

by:
RishadanPort earned 500 total points
ID: 22760351

namespace NoWindowOrConsoleApplication
{
    static class Program
    {
        static void Main()
        { 
           //Write code in here
           //Normally when you want an application to show a windows
           //Form you use this: Application.Run(new ProgramForm());
           //Where "ProgramForm" is the main form used in the C#
           //application
        }
    }
}

Open in new window

0
 

Author Comment

by:gustierng
ID: 22764993
The purpose is to make a .net remoting app on a localhost with services on different processes.  Therefore no need for a console or window.  Also other platforms such as unix allow you to run programs easily in the background without the annoyance of a command window.  So, have been looking or a way to do this.
0
 

Author Comment

by:gustierng
ID: 22765092
When I run the code above, it just runs and exits immediately.
0
 

Author Comment

by:gustierng
ID: 22766164
ok, using Application.Run() keeps it open
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question