C/C++ Windows API

Moderators: Lundin
Number of threads: 443
Number of posts: 1215

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How to supress command window ? Posted by mankash666 on 3 Sept 2008 at 7:26 PM
This is more of a Windows question, so before ppl start asking me to take it elsewhere, if you do know the answer, do let me know!


I am using the system(); function call from a C/C++ application for certain command line calls to the OS (WinXp / Win-Vista-32 are intended target platforms). Every time I invoke the function, a command window opens up, and displays the output. I have tried a number of things from turning echo off to writing the output of the command to a file (for example system(" dir /q > f1.txt") ), BUT, nothing stops the command window from popping up.

How do I stop it from showing up at all?

I am using DevC++ for development, so any mingW/gcc specific makefile options are most welcome.

many thanks!
Report
Re: How to supress command window ? Posted by BitByBit_Thor on 4 Sept 2008 at 4:45 AM
: This is more of a Windows question, so before ppl start asking me to
: take it elsewhere, if you do know the answer, do let me know!
:
:
: I am using the system(); function call from a C/C++ application for
: certain command line calls to the OS (WinXp / Win-Vista-32 are
: intended target platforms). Every time I invoke the function, a
: command window opens up, and displays the output. I have tried a
: number of things from turning echo off to writing the output of the
: command to a file (for example system(" dir /q > f1.txt") ), BUT,
: nothing stops the command window from popping up.
:
: How do I stop it from showing up at all?
:
: I am using DevC++ for development, so any mingW/gcc specific
: makefile options are most welcome.
:
: many thanks!
:

I think the solution is to use an API like CreateProcess: http://msdn.microsoft.com/en-us/library/ms682425(VS.85).aspx
Fill the start up info structure with atleast the flag STARTF_USESHOWWINDOW in dwFlags and wShowWindow to WS_HIDE. I think that should work, though I am not entirely sure.

Best Regards,
Richard

The way I see it... Well, it's all pretty blurry
Report
This post has been deleted. Posted by Lundin on 4 Sept 2008 at 11:20 PM
This post has been deleted.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.