console as background app...

J

Jake Yu

hi,

i want to make the console application running at the background but not
as a service by hiding the console window...

can anyone help me on this?

Jake
 
G

Guest

Do it as a windows app that doesnt have a form. As far as i know you can hide
the console as windows provides it. It will have to be a windows app where
you dont show a form in Main but do something else.

Ciaran O'Donnell
 
J

Jake Yu

Thanks for your reply...

There is a way to hide the console window by calling win32 functions,
GetConsoleWindow and ShowWindow. But it still shows the console window
before trying to hide by calling win32 apis.

Anyway, i created new windows app this time and created a thread to do
what i wanted to do at the background before calling Application.Run()
without passing Form to Run method. But when i finished work in the
thread, i don't know how to quit the app. In vc++, usually posting
WM_QUIT windows message terminates itself, but how do you achieve the
same thing in c#?

Jake
 
D

Dave Sexton

Hi Jake,

1. Returning from the Main method will stop the process

2. Environment.Exit will stop the process

3. Application.Exit will close all Forms and stop all message loops.
Application.Run will then return control to the caller once the exit is
complete.
 
G

Guest

You should call Application.Exit which will return you to the main methods
after the call to application.run().

Ciaran O'Donnell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top