From: hutch-- on
herbert,

[quote]
I want a program similar to the 16 bit choice.com. If you execute
it with:

choice32.exe 66
[/quote]

So what the big deal, write a 32 bit console CHOICE.EXE and rename it
CHOICE.COM, will work fine.

Just set the return value in ExitProcess() to what you want on the
timeout.
From: Herbert Kleebauer on
Rod Pemberton wrote:

> > > So either I need a read with a time-out (there is a SetCommTimeouts(),
> > > but that doesn't work for the stdin handle) or a way to do a non blocking
> > > test for keyboard input. WaitForSingleObject() waits for an event within
> > > a given time-out. But when it returns before the time-out, you only know
> > > that there was an event but not whether it was a keyboard event. And
> > > if it wasn't a keyboard event and you call getc(), then the program
> > > waits until you press a key without any time-out. Therefore, even with
> > > WaitForSingleObject(), you have to use PeekConsoleInput() to inspect
> > > the event and therefore WaitForSingleObject() isn't much better than
> > > a sleep() (which I used in the posted code).
>
> Wow, that killed the conversation... Have you found a solution?

I don't think there is an easier solution than PeekConsoleInput().
But I didn't much research. All I needed was a small program to
include it within a batch program for automatic download a list of
files over night from a file sharing web site (they insert a delay
and input for non paying users).
From: Herbert Kleebauer on
hutch-- wrote:
>
> herbert,
>
> [quote]
> I want a program similar to the 16 bit choice.com. If you execute
> it with:
>
> choice32.exe 66
> [/quote]
>
> So what the big deal, write a 32 bit console CHOICE.EXE and rename it
> CHOICE.COM, will work fine.

I don't want to rename it, CHOICE32.EXE is a good name. All I wanted
was the source code for a (small as possible) CHOICE32.EXE. And I hopped,
there would be a simpler way than using PeekConsoleInput(), but maybe
there isn't. I really hope Microsoft will add 16 bit emulation for
64-bit Windows before it becomes the mainstream. I really don't
understand the people at AMD. If I don't get 16 bit support, I don't
need the x86 at all. If there is no backward compatibility for all
the good old 16 bit code, then let's switch to something completely
new.

> Just set the return value in ExitProcess() to what you want on the
> timeout.

That's the way I did it.
From: Robert Redelmeier on
Herbert Kleebauer <klee(a)unibwm.de> wrote in part:
> I don't think there is an easier solution than PeekConsoleInput().
> But I didn't much research. All I needed was a small program to
> include it within a batch program for automatic download a list of
> files over night from a file sharing web site (they insert a delay
> and input for non paying users).

Sounds OK, but if you put it in a tight loop it could
be a CPU hog. You may want to put a sleep() in there.

-- Robert