Keyboardbuffer clear

Post Reply
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Keyboardbuffer clear

Post by Marc Vanzegbroeck »

Hi,

Probably this is aswer bevore, but I can't find it in the forum.
I have an application with a barcodescanner. It is a barcodescanner connected via USB that is simulating the keyboard

If the barcode is not found, It play an errorsound, and show a message.
The problem is that sometimes the code read by the barcodescanner is so long, that it enter the OK-button of the message, so it is not shown...
I want to clear the keyboard-buffer before showing the alert-box.

Thanks
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
toninhofwi
Posts: 161
Joined: Tue Oct 18, 2005 10:01 am

Re: Keyboardbuffer clear

Post by toninhofwi »

#pragma BEGINDUMP

#include "windows.h"
#include "hbapi.h"

HB_FUNC( CLEARKEYBOARDBUFFER )
{
MSG stMsg = { 0 };

HWND hWnd = ( HWND ) hb_parnl( 1 );

while( PeekMessage( &stMsg, hWnd, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE ) );

hb_ret();
}

#pragma ENDDUMP
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Keyboardbuffer clear

Post by Antonio Linares »

Have you tried calling SysRefresh() ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: Keyboardbuffer clear

Post by Marc Vanzegbroeck »

Sorry for the very late response :lol:

The function CLEARKEYBOARDBUFFER() is working very nice :D

SysRefresh() is not working :(

Thank you
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Post Reply