Article View: borland.public.cppbuilder.nativeapi
Article #14984Re: Debug Console
From: Bob Gonder
Date: Thu, 24 Jul 2003 18:07
Date: Thu, 24 Jul 2003 18:07
31 lines
2019 bytes
2019 bytes
Marco wrote:
> i create a console debug with "AllocConsole()".
>Sometimes the console start before my application main form, how can i minimizzed the console?There is a property or parameter to do this?
It's not very pretty. AFAIK, you need an hWnd to the console. Then
you can do a ShowWindow() on it.
If this is a "debug" feature, is it worth the trouble?
My "solution" for my console apps:
HWND hWnd=0;
static BOOL CALLBACK EnumProc(HWND h, LPARAM thread)
{ if( (DWORD)thread == GetWindowThreadProcessId(h,NULL) )
{ hWnd=h;
return FALSE;
};
return TRUE;
}
void _stdcall GetConsoleHWND(void)
{ long iterations=0;
hWnd=0;
while(hWnd==0)
{ iterations++;
EnumWindows(EnumProc,(LPARAM)GetCurrentThreadId());
if( iterations > 100000L ) break;
};
}
I have no idea why I need to do the iterations thing. Iterations
usually run in the 60-100 range for me. Go fig.
Technical Details
Message-ID:
<bh70ivo6k8krjkltap2v790l3647mvubl0@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!c03.atl99!news.webusenet.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f1ff7d9$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,5cf3641ad9a555c X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-07-24 11:10:40 PST From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Debug Console Date: Thu, 24 Jul 2003 11:07:34 -0700 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <bh70ivo6k8krjkltap2v790l3647mvubl0@4ax.com> References: <3f1ff7d9$1@newsgroups.borland.com> X-Newsreader: Forte Agent 1.91/32.564 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 67.31.165.215 X-Trace: newsgroups.borland.com 1059070054 67.31.165.215 (24 Jul 2003 11:07:34 -0700) Lines: 33 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!c03.atl99!news.webusenet.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail