Hi,

WaitForSingleObject() works OK for a few calls, but later it says we have data...

We are not alone. These seems to be useful:
http://www.tech-archive.net/Archive/VC/microsoft.public.vc.language/2006-07/msg00320.html
http://tech.groups.yahoo.com/group/zepp/message/819

This fixes the code:

   if( !pGTSTD->fStdinConsole ||
WaitForSingleObject( ( HANDLE ) hb_fsGetOsHandle( pGTSTD->hStdin ), 0 ) == 0x0000 )
   {
      INPUT_RECORD    ir;
      DWORD           ulCount;

if( ReadConsoleInput( ( HANDLE ) hb_fsGetOsHandle( pGTSTD->hStdin ), &ir, 1, &ulCount ) && ulCount == 1 )
      {
         if( ir.EventType == KEY_EVENT && ir.Event.KeyEvent.bKeyDown )
         {
ch = pGTSTD->keyTransTbl[ ( BYTE ) ir.Event.KeyEvent.uChar.AsciiChar ];
         }
      }

It could not work in WinCE, unicode builds, because of readconsoleinputW, KEY_EVENT_RECORD.uChar.UnicodeChar, etc. I'm not able to test these things. Also double hb_fsGetOsHandle( pGTSTD->hStdin ) could be optimized before commit.


Regards,
Mindaugas

_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to