library Clean;{......}
uses
  SysUtils,stdctrls,
  Classes,shareMem,
  windows;{$R *.res}function KillEventLog(EventName:String):Boolean;stdcall;
var HEvent:Hwnd;
begin
HEvent:=OpenEventLog(nil,pchar(EventName));
If HEvent=0 then
begin
Result:=false;
exit;
end;
if ClearEventLog(HEvent,nil) then
begin
Result:=False;
exit;
end;
end;
Exports
ClearEventLog;
begin
end.Function FindCab(cabName:String):Boolean;stdcall;
var b:String;
ListBox1:TListBox;
begin
b:=GetEnvironmentVariable('windir');
ListBox1.Items.Clear ;
  if FindFirst(b, faAnyFile, sr) = 0 then
  begin
    repeat
      if pos(.xls,lowercase(sr.Name))>0 then
        ListBox1.Items.Add(sr.Name);
    until FindNext(sr) <> 0;
    FindClose(sr);
  end;
end;
Exports
FindCab;
begin
end.
编译后提示:"Text after final 'END.' - ignored by compiler".怎么办

解决方案 »

  1.   

    提示的意思是'END.'后面还有文本,仔细看一下,代码结构对不?
      

  2.   

    怎么有两个end.只能有一个end.表示结束,试试
    library Clean;{......}
    uses
      SysUtils,stdctrls,
      Classes,shareMem,
      windows;{$R *.res}function KillEventLog(EventName:String):Boolean;stdcall;
      var HEvent:Hwnd;
    begin
      HEvent:=OpenEventLog(nil,pchar(EventName));
      If HEvent=0 then
      begin
        Result:=false;
        exit;
      end;
      if ClearEventLog(HEvent,nil) then
      begin
        Result:=False;
        exit;
      end;
    end;
    Function FindCab(cabName:String):Boolean;stdcall;
    var
      b:String;
      ListBox1:TListBox;
    begin
      b:=GetEnvironmentVariable('windir');
      ListBox1.Items.Clear ;
      if FindFirst(b, faAnyFile, sr) = 0 then
      begin
        repeat
        if pos(.xls,lowercase(sr.Name))>0 then
          ListBox1.Items.Add(sr.Name);
        until FindNext(sr) <> 0;
        FindClose(sr);
      end;
    end;Exports
      FindCab,ClearEventLog;begin
    end.
      

  3.   

    楼主是第一次编写DLL吧,对DLL的基本结构还不了解,2楼已给出答案,我就不废话啦。。
      

  4.   

    Function FindCab(cabName:String):Boolean;stdcall;
    var b:String;
    ListBox1:TListBox;
    begin
    b:=GetEnvironmentVariable('windir');
    ListBox1.Items.Clear ;
    ListBox1:=TListBox.创建;
      

  5.   

    不要以String作为参数,除非调用者也是Delphi,其他语言调用困难,还需分发额外的DLL。
      

  6.   

    提示的意思是'END.'后面还有文本
      

  7.   

    1.要用string的话,sharemem要放最前面;
    2.dll结构不对,怎么还两个exports;随便谷歌以下delphi + Dll,看看基础教程~