鱼C论坛

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

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

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

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

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

x
  1. <p>procedure TForm1.FindDialog1Find(Sender: TObject);
  2. var
  3.   x,CopyPos,PosReturn,SkipChars : Integer;
  4.   StrREG :String;
  5.   Y :String;
  6. begin
  7.   SkipChars:=0;  

  8.   for x:=XIndex to Memo1.Lines.Count - 1 do
  9.   begin
  10.     StrREG:= Memo1.Lines[x];   
  11.     while  PosReturn<>0 do
  12.     begin
  13.       PosReturn:=Pos(FindDialog1.FindText ,StrREG);
  14.       CopyPos:=PosReturn+Length(FindDialog1.FindText);

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

  17.       Memo1.SetFocus ;
  18.       Memo1.SelStart := SkipChars;
  19.       Memo1.SelLength := Length(FindDialog1.FindText );
  20.       XIndex:= x+1;
  21.       if XIndex>Memo1.Lines.Count-1 then
  22.          XIndex := 0 ;
  23.       Break;
  24.     end;
  25.   end;
  26. 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>
复制代码

小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

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

回帖奖励 +3 鱼币

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

  3. interface

  4. uses
  5. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  6. Dialogs, StdCtrls;

  7. type
  8. TForm1 = class(TForm)
  9. Button1: TButton;
  10. procedure Button1Click(Sender: TObject);
  11. end;

  12. var
  13. Form1: TForm1;

  14. implementation

  15. {$R *.dfm}

  16. procedure TForm1.Button1Click(Sender: TObject);
  17. var
  18. p: PChar;
  19. buf: array[0..255] of Char;
  20. begin
  21. p := 'Delphi';

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

  24. lstrcpyn(buf, p, -1);
  25. ShowMessage(buf); {Delphi}
  26. end;

  27. end.
复制代码



你试试这个函数lstrcpyn  f1 里有
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

头像被屏蔽
发表于 2014-11-1 01:22:32 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-4-18 20:34

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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