2013-05-07 1 views

답변

1

텍스트 코드가 양식의 개체 범위에 포함되지 않았습니다. 그것은 단지 단위에 불과했습니다. 그게 문제라고 생각합니다. 버튼의 "onclick"이벤트로 텍스트를 이동 한 후 editTexto 객체를 인식하기 시작했습니다. 그게 말이 되니?

는 전에 :

unit Banri; 

interface 

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

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; 


begin 
    TextoCompleto:= 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); 
      Clipboard.AsText:= SL[Count + 1];; //place next line text in clipboard 
      //if Clipboard.HasFormat(CF_TEXT) then 
      //do something with text 
      inc(Count); 
     end; //while Count <> SL.Count - 1 do 
     SL.Free; 
    end; //if Appwin <> 0 then 

end. 

후 :

unit Banri; 

interface 

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

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:= 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); 
      Clipboard.AsText:= SL[Count + 1];; //place next line text in clipboard 
      //if Clipboard.HasFormat(CF_TEXT) then 
      //do something with text 
      inc(Count); 
     end; //while Count <> SL.Count - 1 do 
     SL.Free; 
    end; //if Appwin <> 0 then 
end; 

end. 
+3

이것은 당신이 묻는 질문에 대한 답변하지 않습니다. 이 "대답"은 우리가 갖지 못한 많은 세부 사항에 의존합니다. 근본적인 문제는 당신이 당신의 질문에 시간을 투자하지 않는다는 것입니다. –

+0

가혹한 것처럼 보일 수도 있지만,이 질문 (및 답변)은 실제로 귀하의 다른 질문과 직접 ​​관련이 있으므로 삭제해야합니다. StackOverflow가 어떻게 작동하는지에 익숙해 지려면 약간의 시간이 걸릴 수 있습니다. 일반 포럼 사이트가 아니기 때문에 StackOverflow가 작동하는 방식에 익숙해지기는하지만 일단 사용법이 익숙해지면 여기에 멋진 리소스가 있습니다. 그러나 당신은 단지 당신 자신의 시간을 가져야하고 정말로 당신이 정말로 갇혀있을 때만 시간을 사용할 것으로 예상됩니다. 도움을 청하기 전에 항상 문제를 재현하십시오. –

관련 문제