Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
My goal of this project is to create a Console Application that changes IE settings in the registry and launches IE9. I did it on vbscript and want to do it on C#.

Question:
Can i run that console App in the background once the whole executable has the 100% release version ? My manager does not like the DOS background window. :(

Thanks for your help,
Posted
Comments
Sergey Alexandrovich Kryukov 25-Feb-13 16:51pm    
What do you mean "in the background", exactly? There is no such thing as "DOS window" for your information.
—SA

The problem is not correctly formulated, because you are confused about the notion of "console application", and many other developers do. This is not your fault; this is because Microsoft documentation is not clear enough about it.

So, in fact you simply want something like "console application not showing console". Here is what is meant by this: you have a choice between the two application types: "Console application" and "Windows application". This is misleading. In reality, it means "Anything, windows application or console application, with default console shown" and "anything, with console hidden".

In other words, both options will allow you to use Windows UI in your application, only first options allows to also use console, another will hide console. You can use all combinations. In you cases, you practically start with console application, but change the application type to "Window application", but don't add any windows or forms. In this case, the console won't be shown. You can even use all your console output method via System.Console, it will just go nowhere, but no exceptions will be thrown, no problems at all.

Problem solved.

—SA
 
Share this answer
 
v2
Comments
namerg 25-Feb-13 17:05pm    
Thank you Sergey, one last question on your statement what do you mean with "output method via System.Console" can you give me a simple example ?" I am new with C#
Sergey Alexandrovich Kryukov 25-Feb-13 17:08pm    
What example?!

System.Console.WriteLine("Hello word!");

I will always work, but, without a console, it won't be shown on screen. Isn't that clear now?

—SA
Sandeep Singh Shekhawat 12-May-14 7:17am    
I used your solution but My application runs only few second by it. I wants it runs continueously.
Sergey Alexandrovich Kryukov 12-May-14 11:13am    
Well, there can be too many different ways to screw up things. I don't know what do you mean by using my solution...
—SA
Sandeep Singh Shekhawat 13-May-14 5:07am    
My mean to say that Console window should be hidden and application should be in running state means I can see it in Task Manager process. Actually It is a server for signalR application that should be in running state to btoadcast any message on event.
Is there any reason why you want a console at all?
Does this need a user interface at all?
If not, just make it a windows forms app, and remove the form. Open the "program.cs" file, and replace the code in the Main method.
Presto! No UI at all.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 25-Feb-13 17:17pm    
Right, but I already answered exact same thing before, only in different (faster) order: do console application first, and later change to "Windows application".
—SA
namerg 26-Feb-13 10:36am    
I did what you suggested but I see a message that the program has stopped working, thanks for your help.
Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: upi_ie9_ge_settings.exe
Problem Signature 02: 1.0.0.0
Problem Signature 03: 512cd4fb
Problem Signature 04: mscorlib
Problem Signature 05: 4.0.0.0
Problem Signature 06: 50484bd7
Problem Signature 07: 3fda
Problem Signature 08: 23b
Problem Signature 09: System.IO.IOException
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900