🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How to keep a console app busy and responsive?

#2333
From: Michael Harris
Date: Wed, 14 Mar 2007 04:31
41 lines
2376 bytes
 in addition..

    while (!dgDone)
    {
        // standard console processing
        //
        INPUT_RECORD lpPeekBuffer = { '\0' };
        DWORD dwNumEventsPeek = 0;
        ::PeekConsoleInput(inHdl,                     // handle to a console 
input buffer
                           &lpPeekBuffer,                  // pointer to the 
buffer for peek data
                           sizeof(INPUT_RECORD), // number of records to 
read
                           &dwNumEventsPeek);        // pointer to number of 
records read
        if(dwNumEventsPeek)
        {
           read the console .. it has events.
        }
      do something else
     repeat..
}

--
Michael


"Helmut Giese" <hgiese@ratiosoft.com> wrote in message 
news:7vtls2tbtoeo4qv75aqhaj8l2e8rvlfrp1@4ax.com...
> Hi Bob,
> many thanks for the info - lots of ways to chose from.
> - Calling FlushConsoleInputBuffer did not change anything
> - going the multi-threaded way looks a bit like too much effort for
> this particular app,
> - so I think I use your polling example
>
> Oh, and thanks for the link to Input Buffer Events.
> Best regards
> Helmut Giese
> 
Technical Details
Message-ID: <45f77ab6@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!volia.net!news2.volia.net!hwmnpeer01.ams!news.highwinds-media.com!feeder1.cambrium.nl!feed.tweaknews.nl!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <i9sjs29ki5ej4eijam2hpftu9p7d39fvjp@4ax.com> <is4ks296qj0743bkljpoireniukn37eas7@4ax.com> <7vtls2tbtoeo4qv75aqhaj8l2e8rvlfrp1@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,c99d91951e405088
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Michael Harris" <techonos-NO-SPAM-@attbi.com>
From: "Michael Harris" <techonos-NO-SPAM-@attbi.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <i9sjs29ki5ej4eijam2hpftu9p7d39fvjp@4ax.com> <is4ks296qj0743bkljpoireniukn37eas7@4ax.com> <7vtls2tbtoeo4qv75aqhaj8l2e8rvlfrp1@4ax.com>
Subject: Re: How to keep a console app busy and responsive?
Date: Tue, 13 Mar 2007 23:31:52 -0500
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 76.187.54.201
Message-ID: <45f77ab6@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1173846710 76.187.54.201 (13 Mar 2007 21:31:50 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!volia.net!news2.volia.net!hwmnpeer01.ams!news.highwinds-media.com!feeder1.cambrium.nl!feed.tweaknews.nl!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail