Solved

running a app with no window or console in the background

Posted on 2008-10-20
8
1,243 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
Industry Leaders: 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

734 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