I want to send a barcode to TEdit called edtCodigo inside a window called TfrmGuiaMovimiento, I am using the following code:
var
h: HWND;
codigo: string;
i: Integer;
begin
h := FindWindow('TfrmGuiaMovimiento',nil);
if h > 0 then
begin
codigo := '7665009887781';
h := FindWindowEx(h, 0, 'edtCodigo', nil);
if h > 0 then
begin
for i := 1 to codigo.Length do SendMessage(h, WM_CHAR, Ord(codigo[i]), 0);
PostMessage(h, WM_KEYDOWN, VK_RETURN, 0);
end;
end;
end;
But I have not got it. But sending the Handle directly works.