空瓶氧气 发表于 2014-10-12 18:20:09

帮我指出注释处的语法错误

<p>procedure TForm1.FindDialog1Find(Sender: TObject);
var
x,CopyPos,PosReturn,SkipChars : Integer;
StrREG :String;
Y :String;
begin
SkipChars:=0;

for x:=XIndex to Memo1.Lines.Count - 1 do
begin
    StrREG:= Memo1.Lines;   
    whilePosReturn<>0 do
    begin
      PosReturn:=Pos(FindDialog1.FindText ,StrREG);
      CopyPos:=PosReturn+Length(FindDialog1.FindText);

      StrREG:=copy(StrREG,CopyPos,(Length(Memo1.Lines)-CopyPos));//这里有什么语法上的错误吗?
      SkipChars := Length(Memo1.Lines) + SkipChars;

      Memo1.SetFocus ;
      Memo1.SelStart := SkipChars;
      Memo1.SelLength := Length(FindDialog1.FindText );
      XIndex:= x+1;
      if XIndex>Memo1.Lines.Count-1 then
         XIndex := 0 ;
      Break;
    end;
end;
end;</p><p> </p><p>错误提示:</p><p> Unit1.pas(193): Missing operator or semicolon</p><p> Unit1.pas(193): Incompatible types: 'String' and 'TAction'</p>

qq351317878 发表于 2014-10-12 21:17:14

WinAPI 字符及字符串函数(11): lstrcpyn - 复制字符串, 同时指定要复制的长度
unit Unit1;

interface

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

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
p: PChar;
buf: array of Char;
begin
p := 'Delphi';

lstrcpyn(buf, p, 3+1);
ShowMessage(buf); {Del}

lstrcpyn(buf, p, -1);
ShowMessage(buf); {Delphi}
end;

end.


你试试这个函数lstrcpynf1 里有

大个的糖果 发表于 2014-11-1 01:22:32

页: [1]
查看完整版本: 帮我指出注释处的语法错误