GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 06-Feb-2007, 13:44
tajjyarden tajjyarden is offline
New Member
 
Join Date: Feb 2007
Posts: 5
tajjyarden is on a distinguished road

how to keep the console window from opening


Hello,

I wrote an application that simply writes some variables to a file. Is there anyone to run this program without the console window appearing at all? Right now you can see the console window open for about half a second and then close. I made sure to remove any code that outputs to the console. I am using MS Visual Studio 2005 and have strated with an empty c++ project.

Thanks,
Tim
  #2  
Old 06-Feb-2007, 14:40
ubergeek ubergeek is offline
Regular Member
 
Join Date: Jan 2005
Posts: 775
ubergeek is a jewel in the roughubergeek is a jewel in the roughubergeek is a jewel in the rough

Re: how to keep the console window from opening


You can create a Windows (GUI) application instead, and just not create a window. The only difference is the signature of main(). It is this instead:
CPP / C++ / C Code:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow);
hInstance is a handle to the instance of your application. You don't need this unless you create a window.
hPrevInstance hasn't been used since 16-bit Windows.
lpCmdLine (NB: LPSTR means char*) is the arguments passed to your program. If you need the arguments in the argv/argc format like you'd have with a regular console program, use the function CommandLineToArgvW.
nCmdShow is a hint about whether the app's main window should be maximized or restored; obviously you can ignore this.

P.S.: You might have to include windows.h.
P.P.S.: I don't use MSVC, but there might be an option somewhere else to just not create a console instead of creating a full-fledged GUI project.
 
 

Recent GIDBlogInstall Adobe Flash - Without Administrator Rights by LocalTech

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB 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
need help with a console menu system BullBuchanan C++ Forum 6 20-Aug-2006 15:46
Getting Input from a Window blank C++ Forum 7 12-Jan-2006 11:07
Bloodshed Dev C++ Project Options JdS C++ Forum 6 11-Nov-2005 18:23
Win32 Window Shading behavior (like linux) WillyumYum C++ Forum 3 18-Apr-2005 15:36
Changing window start colour Rosdahale C++ Forum 5 19-Jan-2005 16:51

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 13:18.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.