How to supress command window ? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

How to supress command window ?

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!

Comments

  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    : 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: [link]http://msdn.microsoft.com/en-us/library/ms682425(VS.85).aspx[/link]
    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
  • LundinLundin Posts: 3,711Member
    This post has been deleted.
Sign In or Register to comment.