🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: clear keyboard buffer

#8162
From: Bob Gonder
Date: Fri, 19 Nov 2004 17:33
19 lines
1568 bytes
Marco wrote:

>Hi everyone,
>  I use "fflush(stdin)" to clear keyboard buffer and the
>function return zero (result is OK).

The API function for Win32 consoles is
(Also flushes mouse events)

	FlushConsoleInputBuffer(stdin);

>  I'd like to know :
>  Is there another function to clear keyboard buffer
>  in GUI application?

 You could _try_ the above, but probably won't work right.
As Alan said, PeekMessage() is what you should use.
Note that it returns all messages, not just keyboard or mouse, so you
need to check the messages and only remove the ones you want.
Technical Details
Message-ID: <i1bsp0lmij3d5obq987ia4qnuicu9d7rpa@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <419e0b48$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,30158ecfeb998ca0
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: clear keyboard buffer
Date: Fri, 19 Nov 2004 09:33:54 -0800
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <i1bsp0lmij3d5obq987ia4qnuicu9d7rpa@4ax.com>
References: <419e0b48$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 69.69.90.96
X-Trace: newsgroups.borland.com 1100885632 69.69.90.96 (19 Nov 2004 09:33:52 -0700)
Lines: 21
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail