Solved

running a app with no window or console in the background

Posted on 2008-10-20
8
1,219 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C# HTTP GET method sample code 3 57
2 questions 10 25
C# bracket error 3 31
transaction in asp.net, sql server 6 33
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

770 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