On Fri, 13 Jun 2008, Michael Ellery wrote:
>
> I would like to accept OLE Events in my script - I've written working
> code that successfully receives events. Now I want to also receive
> some console (stdin) input. I typically use Term::Readline for this,
> although I'm happy to try something else. The basic problem is that
> Win32:OLE MessageLoop() spins forever (or until QuitMessageLoop is
> called). Is there any way I can do something else, like check for
> console input, when MessageLoop is running? Or, perhaps I can do some
> kind of polling loop where I check for events, check for stdin input
> and then sleep briefly (I'm not sure if such a thing is possible).

Using OLE events essentially turns your application into a GUI application,
at least under the hood (OLE creates a hidden window that is used to
serialize the communication between objects).  This is fundamentally
incompatible with doing blocking I/O in the same thread.

You may get something working by using Term::ReadKey::ReadKey() in
non-blocking mode interleaved with calls to Win32::OLE->SpinMessageLoop().

In general it would be better to provide a GUI for your input,
using Tk, Tkx, Win32::GUI, wxPerl etc. which would avoid the problem
altogether.

Cheers,
-Jan

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to