🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #10740

Re: Displaying the console window from a DLL

#10740
From: evil
Date: Tue, 23 Mar 2004 08:09
16 lines
1282 bytes
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: <slrnc5vs61.go.invalid@xs4all.nl>
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
References: <405f5103$1@newsgroups.borland.com> <405f7f59$1@newsgroups.borland.com>

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 00:36:52 PST
Newsgroups: borland.public.cppbuilder.nativeapi
From: evil <invalid@email.address>
Subject: Re: Displaying the console window from a DLL
References: <405f5103$1@newsgroups.borland.com> <405f7f59$1@newsgroups.borland.com>
Message-ID: <slrnc5vs61.go.invalid@xs4all.nl>
User-Agent: slrn/0.9.7.4 (Win32)
NNTP-Posting-Host: 213.84.109.233
Date: 23 Mar 2004 00:09:33 -0800
X-Trace: newsgroups.borland.com 1080029373 213.84.109.233 (23 Mar 2004 00:09:33 -0800)
Lines: 17
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