![]() |
Making a C app run without a console
Hi, I've taken an open source small http server written in 'C' and added: port scanning (for finding an available port to run on), functionality for it to kick open a browser and terminate the server after the browser is closed.
The problem: The executable opens a console window when executed. My attempts:
At this point, I don't know what direction I should be heading. I am not very familiar with Windows programming at all. My goal is to run the executable so that no console window appears, ever. If I have not supplied enough information, please ask me. I am trying to provide everything that is pertinent. I have been using the microsoft "cl" complier and a text editor to develop the software. I've also been searching several ideas as to why I am having so much trouble. Perhaps:
Thanks in advance for any and all help. |
I think there's a code to AllocConsole() that you can get rid of, can we see the code?
|
Quote:
Since you want a Windows app, I'd suggest you write it that way. Goats are expensive; I typically use a bottom-of-the-line chicken. |
You can also take a gander at this: http://www.codeproject.com/win32/runsilent.asp
A quick Google search pulled that up. It might be a bit more effective to write the program as a Windows application, as DaWei said. |
Here is a method that does not require you to modify the existing source code in any manner. But only if you are willing to spend 3 minutes to download and install Dev-C++. It compiles C code as well, don't worry.
- Start a new "Console Application" project. - Discard the automatically generated template code (you do not need this). - Select from the drop menu: "Project -> Project Options". - Click the "Compiler" tab. - Choose "Linker" from the list on the left. - Set "Do not create a console window" to "Yes". |
You can also put that option in the makefile with gcc (as used in Dev-Cpp), but you might not want to get used to proprietary or compiler-specific thangys.
|
the code
Thanks for the help, but I'm still lost. Using the MinGW compiler supplied with Dev-C++, yields many errors. I've posted the code here:
http://www.auburn.edu/~allenbb/files/dhttpd.c |
Which errors?
|
| All times are GMT -5. The time now is 1:27 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC