Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 20th, 2006, 5:08 PM   #1
ibbrowne3
Newbie
 
Join Date: Nov 2006
Posts: 3
Rep Power: 0 ibbrowne3 is on a distinguished road
Unhappy 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:
  • I can use "FreeConsole()" to cause the console (cmd) window to disappear a split second after the executable is run.
  • I've tried importing the existing code into a Visual Studio Express C++ application, ensuring linker options and subsystem are correct.
  • I've considered porting the app to c++ in hopes that I can get somewhere with it at that point.
  • I've created a simple windowed app with the "ShowWindow()" function commented out, and tried wedging the code into the app.

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:
  • I must use Visual Studio to create a windows app that will run my program.
  • C cannot be used to create a console-less application.
  • I have angered the programming gods and must kill a goat.

Thanks in advance for any and all help.
ibbrowne3 is offline   Reply With Quote
Old Nov 20th, 2006, 5:25 PM   #2
niteice
Programmer
 
niteice's Avatar
 
Join Date: Aug 2005
Posts: 98
Rep Power: 4 niteice is on a distinguished road
Send a message via AIM to niteice
I think there's a code to AllocConsole() that you can get rid of, can we see the code?
niteice is offline   Reply With Quote
Old Nov 20th, 2006, 5:44 PM   #3
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Quote:
C cannot be used to create a console-less application.
You can forget that one as silly; of course it can.

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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Nov 20th, 2006, 9:22 PM   #4
Prm753
Professional Programmer
 
Prm753's Avatar
 
Join Date: Oct 2005
Location: United States
Posts: 447
Rep Power: 3 Prm753 is on a distinguished road
Send a message via AIM to Prm753 Send a message via MSN to Prm753
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.
__________________
The world's first athletic computer geek!
The home of PrProgramsStudios
How not to post a question: <-- Please don't reply
Prm753 is offline   Reply With Quote
Old Nov 20th, 2006, 9:33 PM   #5
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,827
Rep Power: 5 Sane will become famous soon enough
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".
Sane is offline   Reply With Quote
Old Nov 20th, 2006, 10:14 PM   #6
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Nov 21st, 2006, 12:27 PM   #7
ibbrowne3
Newbie
 
Join Date: Nov 2006
Posts: 3
Rep Power: 0 ibbrowne3 is on a distinguished road
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
ibbrowne3 is offline   Reply With Quote
Old Nov 21st, 2006, 12:40 PM   #8
niteice
Programmer
 
niteice's Avatar
 
Join Date: Aug 2005
Posts: 98
Rep Power: 4 niteice is on a distinguished road
Send a message via AIM to niteice
Which errors?
niteice is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Manipulating the console using Windows API rup C++ 2 Nov 17th, 2006 1:04 PM
The Black Art of Video Game Console Design lostcauz Book Reviews 0 Apr 26th, 2006 7:31 PM
Tutorials for making a P2P program? Palladio C++ 3 Nov 26th, 2005 3:51 AM
console output matko C++ 10 Sep 26th, 2005 2:14 PM
Making a Note Adder/ Editor/ Deleter/ Viewer thingy brokenhope C++ 19 Apr 29th, 2005 1:30 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:29 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC