Solved

running a app with no window or console in the background

Posted on 2008-10-20
8
1,236 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

726 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