Te pongo un ejemplo, de hecho, no hace falta ningún edit para procesar los mensajes de teclado, pero bueno....
Interceptas los mensajes con un TApplicationEvents:
Código Delphi
[-]
procedure TFormMain.ApplicationEventsMessage(var Msg: tagMSG; var Handled: Boolean);
begin
Handled := False;
if (Msg.Message = WM_KEYDOWN) then
BEGIN
if Msg.wParam = 17 then
Begin
lBarCode := True;
Handled := True ;
Exit;
End;
if (Msg.wParam = 66) And lBarCode then
Begin
lBarCode1 := True;
Handled := True ;
Exit;
End;
if (Msg.wParam <> 13) And lBarCode1 then
Begin
cBarCode := cBarCode + Chr(Msg.wParam);
Handled := True ;
Exit;
End;
if (Msg.wParam = 13) And lBarCode1 then
Begin
lBarCode := False;
lBarCode1 := False;
Handled := True;
DoCodeBar(NIL);
End;
END;
end;
Luego el procedimiento que procesa las entradas.... (A MODO DE EJEMPLO)
Código Delphi
[-]
procedure TFormMain.DoCodeBar(Sender : TObject);
Var
cPrefix1 : String;
cPrefix2 : String;
cPrefix3 : String;
Begin
if cBarCode = '' then Exit;
Try
ApplicationEvents.OnMessage := nil;
Application.ProcessMessages;
Memo1.Lines.Add(cBarCode);
cPrefix1 := Copy(cBarCode,1,4);
cPrefix2 := Copy(cBarCode,5,4);
cPrefix3 := Copy(cBarCode,9,4);
cBarCode := '';
If cPrefix1 = '0110' then
Begin
Actionxxx.Execute;
End;
If cPrefix1 = '0211' then
Begin
Actionxxxzzzi.Execute;
End;
If cPrefix1 = '0212' then
Begin
Actiondddi.Execute;
End;
finally
ApplicationEvents.OnMessage := ApplicationEventsMessage;
End;
End;
Evidentemente, la codificación dependerá de tus códigos y por supuesto de como esté configurado el lector.
Espero que te resulte útil..
Saludos
