鱼C论坛

 找回密码
 立即注册
查看: 2435|回复: 2

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

[复制链接]
发表于 2014-10-12 18:20:09 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
<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[x];   
    while  PosReturn<>0 do
    begin
      PosReturn:=Pos(FindDialog1.FindText ,StrREG); 
      CopyPos:=PosReturn+Length(FindDialog1.FindText);

      StrREG:=copy(StrREG,CopyPos,(Length(Memo1.Lines[x])-CopyPos));//这里有什么语法上的错误吗?
      SkipChars := Length(Memo1.Lines[x]) + 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>[Error] Unit1.pas(193): Missing operator or semicolon</p><p>[Error] Unit1.pas(193): Incompatible types: 'String' and 'TAction'</p>
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2014-10-12 21:17:14 | 显示全部楼层

回帖奖励 +3 鱼币

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[0..255] of Char;
begin
p := 'Delphi';

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

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

end.


你试试这个函数lstrcpyn  f1 里有
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

头像被屏蔽
发表于 2014-11-1 01:22:32 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-7-3 02:38

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表