0

いくつかのテキストで動作するプログラムを作成しようとしています (すべての "." を削除し、2 つのテキスト ブロックをまとめて結果を別のプログラムに貼り付け、TAB を使用してテキスト フィールドを移動します。

これがコード内の現在の場所です。

unit Banri;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Clipbrd, sndkey32;

type
  TForm1 = class(TForm)
    EditTexto: TEdit;
    ButtonGO: TButton;
    procedure ButtonGOClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  SL: TStringList;
  Count: Integer;
  Appwin : hWnd;

implementation

{$R *.dfm}

  var
  TextoCompleto: String;


procedure TForm1.ButtonGOClick(Sender: TObject);
begin
  TextoCompleto:= Trim(EditTexto.Text);
  Appwin:= FindWindow(PChar(0),'Banrisul');
  if Appwin <> 0 then
  begin
      StringReplace(TextoCompleto, '.', '', [rfReplaceAll, rfIgnoreCase]);

      SL:= TStringList.Create;
      try
        ExtractStrings([' '], [], PChar(TextoCompleto), SL);
        WriteLn(SL.Text);
        ReadLn;
      finally
        SL.Free;
  end;
      Count:= 0;
      while Count <> SL.Count - 1 do
      begin
          Clipboard.AsText:= SL[Count]; //place text in clipboard
          //if Clipboard.HasFormat(CF_TEXT) then
          //do something with text
          ShowMessage(Clipboard.AsText);
          PostMessage(Appwin.Handle, WM_KEYDOWN, VK_TAB, 0);
          PostMessage(FindWindow(PChar(0),'Banrisul').Handle, WM_KEYUP, VK_TAB, 0);
      end; //while Count <> SL.Count - 1 do
      SL.Free;
  end; //if Appwin <> 0 then
end;

end.

PostMessage(Appwin.Handle, WM_KEYDOWN, VK_TAB, 0); でエラーが発生しています。

Appwin の結果を .Handle で使用できないのはなぜですか?

4

1 に答える 1