Really? I just created a simple test application in MS VC++ 6 here, and the fprintf(stderr, ...) statements I put inside WinMain don't seem to do anything at all. (same with stdout)

In fact, I'm not sure that what the poster is asking about can be done at all, really - when you start a win32 gui application from the command prompt, the command prompt returns to you as soon as the executeable is loaded. I don't think it's possible to have a win32 gui application that interacts with the command window from which it was launched, by windows' design.

It is of course possible to have a win32 console application that hides its own console window immediately after launching, and to write a console application that detaches from its console window, but both of those will flash a console window onscreen before continuing.

I'll go check the Microsoft documentation to see if what the poster desires is even possible with windows.


Update: There's a function that's new in windows XP that'll let you re-attach to the parent console (AttachConsole) however, this still has problems, because your output will be all messed up with the returned command line prompt, and you can't really read from the console in that case.

But the cause is not helpless! Googling on AttachConsole gave this article which contains a workaround, which I'll post separately.


In reply to Re: Re: Re: STDOUT and a PAR --gui executable by fizbin
in thread STDOUT and a PAR --gui executable by crabbdean

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.