Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
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. Frown | :(
 
Thanks for your help,
Posted 25-Feb-13 10:48am
namerg384
Comments
Sergey Alexandrovich Kryukov at 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
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
v2
Comments
namerg at 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 at 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 at 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 at 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 at 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.
Sergey Alexandrovich Kryukov at 13-May-14 15:43pm
   
If the console is always hidden, you just don't need its. Don't use "Console Application" type. That's all.
—SA
Sandeep Singh Shekhawat at 13-May-14 23:53pm
   
First and foremost Thanks to you for back to back quick response. What can be alternate of this? Should I go with windows service or windows form application? What do you like to suggest me?
Sergey Alexandrovich Kryukov at 14-May-14 0:40am
   
I can suggest something if you explain your ultimate goals. You cannot say "I want to create a console application", because I'll ask "why"? Why set the registry, why run IE? Who is the user and what if that use doesn't have UI? And so on.
—SA
Sandeep Singh Shekhawat at 15-May-14 0:28am
   
Thanks SA.
Sergey Alexandrovich Kryukov at 15-May-14 14:08pm
   
My pleasure.
Good luck, call again.
—SA
Sergey Alexandrovich Kryukov at 25-Feb-13 17:15pm
   
I'm not sure you know where to set the option, so, just in case:
Console or not, is the option for compilation of the application entry assembly. With Visual Studio, you go to project's Properties, the tab "Application".
—SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
Comments
Sergey Alexandrovich Kryukov at 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 at 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)

  Print Answers RSS
0 OriginalGriff 310
1 Sergey Alexandrovich Kryukov 176
2 PhilLenoir 164
3 Richard MacCutchan 160
4 Sharmanuj 156
0 Sergey Alexandrovich Kryukov 6,081
1 OriginalGriff 5,115
2 CPallini 2,473
3 Richard MacCutchan 1,597
4 Abhinav S 1,505


Advertise | Privacy | Mobile
Web03 | 2.8.140814.1 | Last Updated 25 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100