Hey.
I have another problem with sneaky win 10.
I need to get barcode reader data always, so far i havent found good solution. Win does not allow open keyboard as HID device.
System at the moment: Small PC, no internet, no display, no keyboard, no other user input. Only Barcode reader.
All windows messages and notifications are turned off.
Cursor is automatically set to edit box at program start, also program has implemented automatic focusing system in case application will be deactivated.
But windows is sneaky bastard. It may trigger some ridicolus message or notification, eg lets set thing up, lets finish setup, better user experience and so on.
My program triggers automatic focus gain, application will be activated, takbar icon is yellow colored but that poor input will not transfer where it meant to be and no scanner data.
Refocusing code is:
procedure TForm1.Timer1Timer(Sender: TObject);
var
I: LPInput;
begin
Timer1.Enabled:= False;// timer activated focus regain code
if Self.cbAutoFocusHold.Checked = False then // checkbox unchecked, ignore auto focusing
Exit;
I := nil;
try
// Hack #2: send myself some dummy input
GetMem(I,SizeOf(Input));
FillChar(I^, SizeOf(Input),$00); // empty input structure
SendInput(1, I, SizeOf(Input));
SetForegroundWindow(Application.MainForm.Handle);
finally
if I <> nil then FreeMem(I,SizeOf(Input));
end;
SetActiveWindow(Self.Handle);
edBarcodeInput.SetFocus;
memLog.Lines.Add('refocused');
end;
Maybe there is something wrong with the focus grab code, but better way is get barcode data directly.
Also there is no VSP entry in device manager.
Any help/idea/sugestion is very welcomed.