Article View: borland.public.cppbuilder.nativeapi
Article #10742Re: Displaying the console window from a DLL
From: p Anders
Date: Tue, 23 Mar 2004 13:58
Date: Tue, 23 Mar 2004 13:58
20 lines
1666 bytes
1666 bytes
Thanks - that worked!
"evil" <invalid@email.address> wrote in message
news:slrnc5vs61.go.invalid@xs4all.nl...
> AllocConsole();
> f = freopen("CONOUT$", "wb", stdout);
>
> Should be all you need.
>
> From what I understand the main application already has a console
> open. If it's a standard Win32 console, this code should work
> just fine and send all stdout output there. And if it isn't, the
> dll will open one.
> Don't forget to fclose(f); at exit. It's stdout so it won't really
> leak file handles but you might get those silly codeguard warnings ;)
>
>
> --
>
> Acting stupid is often smart.
>
Technical Details
Message-ID:
<40604284$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<405f5103$1@newsgroups.borland.com> <405f7f59$1@newsgroups.borland.com> <slrnc5vs61.go.invalid@xs4all.nl>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,88f1324ce9517901 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-03-23 06:04:01 PST Reply-To: "p Anders" <paul.anderson@jhuapl.edu> From: "p Anders" <paul.anderson@jhuapl.edu> Newsgroups: borland.public.cppbuilder.nativeapi References: <405f5103$1@newsgroups.borland.com> <405f7f59$1@newsgroups.borland.com> <slrnc5vs61.go.invalid@xs4all.nl> Subject: Re: Displaying the console window from a DLL Date: Tue, 23 Mar 2004 08:58:29 -0500 Lines: 22 Organization: JHU/APL X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 128.244.21.78 Message-ID: <40604284$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1080050308 128.244.21.78 (23 Mar 2004 05:58:28 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail