Article View: borland.public.cppbuilder.nativeapi
Article #13832Re: How to hide console app (2)
From: Bob Gonder
Date: Wed, 17 Sep 2003 08:24
Date: Wed, 17 Sep 2003 08:24
42 lines
2268 bytes
2268 bytes
Islaw wrote:
>
>Could you please post it?
>
From: Bob Gonder
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Debug Console
Date: Thu, 24 Jul 2003 11:07:34 -0700
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:
<6d6gmv8ihf54dmpv4f7chg24uc029q40o0@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!pln-w!extra.newsguy.com!lotsanews.com!news-hog.berkeley.edu!ucberkeley!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3f67629e.4384674@forums.borland.com> <3f677334@newsgroups.borland.com> <6lkfmv0ihgie53596gqi5rrlpf2lpo7qtj@4ax.com> <3f67f96e$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,b03daf96279795a8 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-09-17 01:34:11 PST From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: How to hide console app (2) Date: Wed, 17 Sep 2003 01:24:03 -0700 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <6d6gmv8ihf54dmpv4f7chg24uc029q40o0@4ax.com> References: <3f67629e.4384674@forums.borland.com> <3f677334@newsgroups.borland.com> <6lkfmv0ihgie53596gqi5rrlpf2lpo7qtj@4ax.com> <3f67f96e$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.194 X-Trace: newsgroups.borland.com 1063787044 67.31.165.194 (17 Sep 2003 01:24:04 -0700) Lines: 44 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!pln-w!extra.newsguy.com!lotsanews.com!news-hog.berkeley.edu!ucberkeley!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail