tags:

views:

99

answers:

4

I want to hide my console of c when I run my application, kindly guide me how can I make it possible so that my application run in the background.

+2  A: 

The easiest way to do this is to use a Windows Forms project rather than Console and then hide the startup form. The other option of course is a Windows Service, but this might be overkill ...

Bermo
your answer is like mine. +1.
acidzombie24
A: 

IIRC theres no way to do it programmatic. There are options to do it. I think i done it in the past by creating a windows project but having no windows form code (i just including the files from my console app). No console window popped up. I believe i did it in codeblock once by changing an option in the gui. I am sorry i cant be specific but i am using 2010 rc and the way i do it there may not be the same as yours

-edit-

your comment makes me think that your spawning processes. You do it by the function you call. I dont know what language your using (i'll assume C bc you said your launhing a C app you created?) but there is either a flag to say hide window or (or a flag you dont set to not show it) or use an alternative function which does the same thing but launches the process a different way. Try shellexecute and system()

acidzombie24
A: 

Use CreateProcess with the DETACH_PROCESS flag.

Jerry Coffin
+2  A: 

Programs with main() by default are compiled as SUBSYSTEM:CONSOLE applications and get a console window. If you own the other processes your application is starting, you could modify them to be windowed applications by one of the following methods:

  • Modify them to use WinMain() instead of main(). This is the typical approach but requires modifying code. (If the reason for using main() is for easy access to argc/argv, MSVC provides global __argc/__argv equivalents for windowed applications.)
  • Explicitly specifying the subsystem and entry point via /SUBSYSTEM:WINDOWS /ENTRY:main arguments to link.exe.
  • Use editbin.exe to change the subsystem type after the fact. This one might be useful if you don't have source code access to the spawned processes.
jamesdlin
Thanks For your help.
Arman