请教一条出错信息的解决方法,谢谢各位前辈 ( 积分: 50 )

  • 主题发起人 主题发起人 copyyour
  • 开始时间 开始时间
C

copyyour

Unregistered / Unconfirmed
GUEST, unregistred user!
[Error] Unit1.pas(78): Unsatisfied forward or external declaration: 'TSearchFileThread.Execute'<br><br>'TSearchFileThread.Execute' &nbsp;就是这个到底是什么,已经uses shellapi了
 
[Error] Unit1.pas(78): Unsatisfied forward or external declaration: 'TSearchFileThread.Execute'<br><br>'TSearchFileThread.Execute' &nbsp;就是这个到底是什么,已经uses shellapi了
 
你查看一下<br>是不是定义的函数头没定义函数体<br>最快的办法是按Ctrl+Alt+C<br>Delphi会自动帮你完成函数体的轮廓<br>你只要在它生成的框架内写功能代码就行了
 
Ctrl+Alt+C还是不行,因为我是移植另外一个程序过来,基本已经都移植了,不知道还有那些地方有问题。<br>TSearchFileThread=class(TThread)<br>就是这地方,出错地方事<br>procedure SearchFile(DirName: string);
 
你把代码贴上来吧<br>不然只能猜了
 
private<br> &nbsp; &nbsp;{ Private declarations }<br><br> &nbsp; &nbsp; &nbsp;public<br><br> &nbsp; &nbsp;{ Public declarations }<br> &nbsp;end;<br> &nbsp;TSearchFileThread=class(TThread)<br> &nbsp;private<br> &nbsp; &nbsp;MyFileName: string;<br> &nbsp; &nbsp;MyFileSize: Integer ;<br> &nbsp; &nbsp;procedure SearchFile(DirName: string);<br> &nbsp; &nbsp;procedure DeelWithFile;<br> &nbsp; &nbsp;procedure SearchComplete;<br> &nbsp;public<br> &nbsp; &nbsp;MyDirName: string;<br> &nbsp;protected<br> &nbsp; &nbsp;procedure Execute; override;<br> &nbsp;end;<br><br>var<br> &nbsp;Form1: TForm1;<br> &nbsp;SearchFileThread: TSearchFileThread ;<br> &nbsp;{总共查找了多少文件}<br> &nbsp;SumSearchFile, OverSearchFile, MyFileSize: Integer ;<br> &nbsp;{控制停止开关}<br> &nbsp;Onoff, OnOff1: Boolean ;<br> &nbsp;TempString: TStrings ;<br> &nbsp;ShowFileName, ShowFile: string ;<br><br>implementation<br><br>{$R *.dfm}
 
完整一点<br>private<br> &nbsp; &nbsp;{ Private declarations }<br><br> &nbsp; &nbsp; &nbsp;public<br><br> &nbsp; &nbsp;{ Public declarations }<br> &nbsp;end;<br>这部分是做什么的
 
unit Unit1;<br><br>interface<br><br>uses<br> &nbsp;Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> &nbsp;Dialogs, ComCtrls, bsSkinCtrls, bsSkinShellCtrls, StdCtrls,<br> &nbsp;bsSkinBoxCtrls, Mask, bsSkinTabs, bsDialogs, ImgList, SkinBoxCtrls,<br> &nbsp;SkinCtrls, bsSkinData, BusinessSkinForm, Menus, bsSkinMenus;<br><br>type<br> &nbsp;TForm1 = class(TForm)<br> &nbsp; &nbsp;bsSkinStdLabel1: TbsSkinStdLabel;<br> &nbsp; &nbsp;bsSkinButton1: TbsSkinButton;<br> &nbsp; &nbsp;Edit1: TbsSkinEdit;<br> &nbsp; &nbsp;bsSkinSelectDirectoryDialog1: TbsSkinSelectDirectoryDialog;<br> &nbsp; &nbsp;bsSkinPanel1: TbsSkinPanel;<br> &nbsp; &nbsp;bsSkinGroupBox1: TbsSkinGroupBox;<br> &nbsp; &nbsp;bsSkinPageControl1: TbsSkinPageControl;<br> &nbsp; &nbsp;bsSkinTabSheet1: TbsSkinTabSheet;<br> &nbsp; &nbsp;bsSkinTabSheet2: TbsSkinTabSheet;<br> &nbsp; &nbsp;bsSkinStatusBar1: TbsSkinStatusBar;<br> &nbsp; &nbsp;bsSkinTabSheet3: TbsSkinTabSheet;<br> &nbsp; &nbsp;bsSkinTabSheet4: TbsSkinTabSheet;<br> &nbsp; &nbsp;bsSkinGroupBox2: TbsSkinGroupBox;<br> &nbsp; &nbsp;bsSkinListView1: TbsSkinListView;<br> &nbsp; &nbsp;bsSkinButton2: TbsSkinButton;<br> &nbsp; &nbsp;bsSkinButton3: TbsSkinButton;<br> &nbsp; &nbsp;bsSkinButton4: TbsSkinButton;<br> &nbsp; &nbsp;bsSkinButton5: TbsSkinButton;<br> &nbsp; &nbsp;bsSkinButton6: TbsSkinButton;<br> &nbsp; &nbsp;bsSkinScrollBar1: TbsSkinScrollBar;<br> &nbsp; &nbsp;bsSkinInputDialog1: TbsSkinInputDialog;<br> &nbsp; &nbsp;ImageList1: TImageList;<br> &nbsp; &nbsp;bsSkinListView2: TbsSkinListView;<br> &nbsp; &nbsp;bsSkinScrollBar2: TbsSkinScrollBar;<br> &nbsp; &nbsp;bsSkinButton7: TbsSkinButton;<br> &nbsp; &nbsp;bsSkinButton9: TbsSkinButton;<br> &nbsp; &nbsp;bsSkinButton11: TbsSkinButton;<br> &nbsp; &nbsp;bsSkinStatusPanel1: TbsSkinStatusPanel;<br> &nbsp; &nbsp;bsSkinStatusPanel2: TbsSkinStatusPanel;<br> &nbsp; &nbsp;bsSkinStatusPanel3: TbsSkinStatusPanel;<br> &nbsp; &nbsp;bsSkinStatusPanel4: TbsSkinStatusPanel;<br> &nbsp; &nbsp;bsSkinStatusPanel5: TbsSkinStatusPanel;<br> &nbsp; &nbsp;bsSkinStatusPanel6: TbsSkinStatusPanel;<br> &nbsp; &nbsp;spSkinStdLabel1: TspSkinStdLabel;<br> &nbsp; &nbsp;spSkinEdit1: TspSkinEdit;<br> &nbsp; &nbsp;Animate1: TAnimate;<br> &nbsp; &nbsp;bsSkinButton12: TbsSkinButton;<br> &nbsp; &nbsp;bsSkinPopupMenu1: TbsSkinPopupMenu;<br> &nbsp; &nbsp;N1: TMenuItem;<br> &nbsp; &nbsp;bsBusinessSkinForm1: TbsBusinessSkinForm;<br> &nbsp; &nbsp;bsSkinData1: TbsSkinData;<br> &nbsp; &nbsp;bsSkinButton8: TbsSkinButton;<br> &nbsp; &nbsp;procedure bsSkinButton1Click(Sender: TObject);<br> &nbsp; &nbsp;procedure bsSkinButton2Click(Sender: TObject);<br> &nbsp; &nbsp;procedure bsSkinButton5Click(Sender: TObject);<br> &nbsp; &nbsp;procedure bsSkinButton6Click(Sender: TObject);<br> &nbsp; &nbsp;procedure bsSkinButton4Click(Sender: TObject);<br> &nbsp; &nbsp;procedure bsSkinButton3Click(Sender: TObject);<br> &nbsp; &nbsp;procedure bsSkinButton11Click(Sender: TObject);<br> &nbsp; &nbsp;procedure bsSkinButton7Click(Sender: TObject);<br> &nbsp; &nbsp;procedure bsSkinButton9Click(Sender: TObject);<br> &nbsp; &nbsp;procedure FormCreate(Sender: TObject);<br> &nbsp; &nbsp;procedure bsSkinButton12Click(Sender: TObject);<br> &nbsp; &nbsp;procedure N1Click(Sender: TObject);<br> &nbsp;private<br> &nbsp; &nbsp;{ Private declarations }<br> &nbsp;public<br> &nbsp; &nbsp;{ Public declarations }<br> &nbsp;end;<br> &nbsp;TSearchFileThread=class(TThread)<br> &nbsp;private<br> &nbsp; &nbsp;MyFileName: string;<br> &nbsp; &nbsp;MyFileSize: Integer ;<br> &nbsp; &nbsp;procedure SearchFile(DirName: string);<br> &nbsp; &nbsp;procedure DeelWithFile;<br> &nbsp; &nbsp;procedure SearchComplete;<br> &nbsp;public<br> &nbsp; &nbsp;MyDirName: string;<br> &nbsp;protected<br> &nbsp; &nbsp;procedure Execute; override;<br> &nbsp;end;<br>var<br> &nbsp;Form1: TForm1;<br> &nbsp;SearchFileThread: TSearchFileThread ;<br> &nbsp;{总共查找了多少文件}<br> &nbsp;SumSearchFile, OverSearchFile, MyFileSize: Integer ;<br> &nbsp;{控制停止开关}<br> &nbsp;Onoff, OnOff1: Boolean ;<br> &nbsp;TempString: TStrings ;<br> &nbsp; &nbsp;ShowFileName, ShowFile: string ;<br>implementation<br><br>{$R *.dfm}<br>procedure TSearchFileThread.DeelWithFile;<br>begin<br> &nbsp;OverSearchFile := OverSearchFile + 1 ;<br> &nbsp;form1.bsSkinStatusPanel4.Caption := IntToStr(OverSearchFile );<br> &nbsp;ShowFile := &nbsp;ExtractFileName(MyFileName );<br> &nbsp;ShowFileName := ExtractFilePath(MyFileName ) + ShowFile;<br> &nbsp;form1.bsSkinListView2.Items.Add.Caption := ShowFileName ;<br> &nbsp;form1.bsSkinListView2.Items.Item[form1.bsSkinListView2.Items.Count - 1].SubItems.Text := Inttostr(MyFileSize div 1024 )+' KB';<br>end;<br><br>procedure TForm1.bsSkinButton12Click(Sender: TObject);<br>var<br> &nbsp;I: Integer;<br>begin<br> for i:=0 to bsSkinListView2.Items.Count-1 do<br> &nbsp; if bsSkinListView2.Items.Item.Checked then<br> &nbsp; &nbsp; DeleteFile(bsSkinListView2.Items.Item.Caption);<br><br>end;<br><br>procedure TSearchFileThread.SearchFile(DirName: String);<br>Var<br> &nbsp;I, index, s: Integer;<br> &nbsp;Found: integer;<br> &nbsp;SearchRec: TSearchRec;<br>begin<br> &nbsp;while onoff = false &nbsp;do<br> &nbsp;begin<br> &nbsp; &nbsp;exit ;<br> &nbsp;end; &nbsp; &nbsp;// while<br> &nbsp;Found := FindFirst(DirName + '*.*',faAnyFile,searchrec);<br> &nbsp;while Found = 0 do<br> &nbsp;begin<br> &nbsp; &nbsp;{如果加下面这行就是只查找目录,不查找文件}<br> &nbsp; &nbsp;//if ((SearchRec.Attr and faDirectory) &lt;&gt; 0) then &nbsp;//directory<br> &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp;if(SearchRec.Name &lt;&gt; '.')and(SearchRec.Name &lt;&gt; '..') then<br> &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp;SearchFile(DirName + SearchRec.Name + '/');<br> &nbsp; &nbsp; &nbsp; &nbsp;MyFileName := DirName + SearchRec.Name;<br> &nbsp; &nbsp; &nbsp; &nbsp;{加上判断只显示规定的类型 }<br> &nbsp; &nbsp; &nbsp; &nbsp;SumSearchFile := SumSearchFile + 1 ;<br> &nbsp; &nbsp; &nbsp; &nbsp;form1.bsSkinStatusPanel2.Caption := IntToStr( SumSearchFile ) ;<br> &nbsp; &nbsp; &nbsp; &nbsp;form1.bsSkinStatusPanel6.Caption := MyFileName ;<br> &nbsp; &nbsp; &nbsp; &nbsp;//if &nbsp;(ExtractFileName(Application.ExeName ) - ExtractFileExt(MyFileName) = form1.Edit2.Text then<br> &nbsp; &nbsp; &nbsp; &nbsp;i := 0 ;<br> &nbsp; &nbsp; &nbsp; &nbsp;index := 0 ;<br> &nbsp; &nbsp; &nbsp; &nbsp;if OnOff1 = true then<br> &nbsp; &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TempString := TStringList.Create ;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OnOff1 := false ;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for I := 0 to form1.bsSkinListView1.Items.Count - 1 do &nbsp; &nbsp;// Iterate<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if form1.bsSkinListView1.Items.Item.Checked then<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TempSTring.Insert(index,form1.bsSkinListView1.Items.Item.Caption ) ;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;index := index + 1 ;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp; &nbsp; &nbsp;for I := 0 to TempString.Count - 1 &nbsp;do &nbsp; &nbsp;// Iterate<br> &nbsp; &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if '*'+ExtractFileExt(MyFileName) = TempSTring.Strings then<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MyFileSize := searchrec.Size ;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Synchronize(DeelWithFile);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp; &nbsp; &nbsp;end; &nbsp; &nbsp;// for<br> &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp;end;<br> &nbsp; &nbsp;Found := FindNext(SearchRec);<br> &nbsp;end;<br> &nbsp;FindClose(SearchRec);<br>end;<br><br>procedure TSearchFileThread.SearchComplete;<br>begin<br> &nbsp;Form1.Animate1.Active := False &nbsp;;<br> &nbsp;Application.MessageBox( PChar('搜索完毕,共找到 '+inttostr(OverSearchFile )) , PChar('提示'), MB_OK +<br> &nbsp; &nbsp; MB_ICONINFORMATION + MB_TOPMOST);<br> &nbsp;form1.bsSkinStatusPanel6.Caption := '扫描完成......' ;<br>end;<br><br>procedure TSearchFileThread.Execute;<br>begin<br> &nbsp;SearchFile(MyDirName);<br> &nbsp;Synchronize(SearchComplete);<br>end;<br><br>procedure TForm1.bsSkinButton1Click(Sender: TObject);<br>begin<br> &nbsp;if bsSkinSelectDirectoryDialog1.Execute then<br> &nbsp;begin<br> &nbsp; &nbsp;edit1.Text := bsSkinSelectDirectoryDialog1.Directory ;<br> &nbsp;end;<br>end;<br><br>procedure TForm1.bsSkinButton2Click(Sender: TObject);<br>begin<br> &nbsp;bsSkinListView1.Items.Item[2].Checked := true ;<br> &nbsp;bsSkinListView1.Items.Item[3].Checked := true ;<br> &nbsp;bsSkinListView1.Items.Item[4].Checked := true ;<br> &nbsp;bsSkinListView1.Items.Item[5].Checked := true ;<br> &nbsp;bsSkinListView1.Items.Item[8].Checked := true ;<br> &nbsp;bsSkinListView1.Items.Item[9].Checked := true ;<br> &nbsp;bsSkinListView1.Items.Item[10].Checked := true ;<br> &nbsp;bsSkinListView1.Items.Item[11].Checked := true ;<br> &nbsp;bsSkinListView1.Items.Item[12].Checked := true ;<br> &nbsp;bsSkinListView1.Items.Item[18].Checked := true ;<br> &nbsp;bsSkinListView1.Items.Item[27].Checked := true ;<br>end;<br><br>procedure TForm1.bsSkinButton5Click(Sender: TObject);<br>var<br> &nbsp;SumIndexCheck: Integer ;<br>begin<br> &nbsp;for sumIndexCheck := 0 to bsSkinListView1.Items.Count - 1 do &nbsp; &nbsp;// Iterate<br> &nbsp;begin<br> &nbsp; &nbsp;bsSkinListView1.Items.Item[SumIndexCheck].Checked := True &nbsp;;<br> &nbsp;end; &nbsp; &nbsp;// for<br>end;<br><br>procedure TForm1.bsSkinButton6Click(Sender: TObject);<br>var<br> &nbsp;I: Integer;<br> &nbsp;sumIndexCheck: Integer ;<br>begin<br> for sumIndexCheck := 0 to bsSkinListView1.Items.Count - 1 do &nbsp; &nbsp;// Iterate<br> begin<br> &nbsp; bsSkinListView1.Items.Item[sumIndexCheck].Checked := false ;<br> end; &nbsp; &nbsp;// for<br>end;<br><br>procedure TForm1.bsSkinButton4Click(Sender: TObject);<br>begin<br> &nbsp;bsSkinListView1.DeleteSelected &nbsp;;<br>end;<br>procedure TForm1.bsSkinButton3Click(Sender: TObject);<br>var<br> &nbsp;InputString: String ;<br> &nbsp;NewString: ttreenode ;<br> &nbsp;i: Integer;<br>begin<br> &nbsp;i := 0;<br> &nbsp;InputString := bsSkinInputDialog1.InputBox('输入信息','输入新增文件类型','*.*') ;<br> &nbsp;if inputString = '' then<br> &nbsp;begin<br> &nbsp; &nbsp;Application.MessageBox('请正确输入文件类型 !!', PChar('提示'), MB_OK +<br> &nbsp; &nbsp; MB_ICONINFORMATION + MB_TOPMOST);<br> &nbsp; &nbsp;exit ;<br> &nbsp;end<br> &nbsp;else<br> &nbsp;begin<br> &nbsp; &nbsp;for i := 0 to bsSkinListView1.Items.Count - 1 do<br> &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp;if bsSkinListView1.Items.Item.Caption = InputString then<br> &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp;Application.MessageBox('此类型已经存在 !!', PChar('提示'), MB_OK +<br> &nbsp; &nbsp; &nbsp;MB_ICONINFORMATION + MB_TOPMOST);<br> &nbsp; &nbsp; &nbsp; &nbsp;exit ;<br> &nbsp; &nbsp; &nbsp;end ;<br> &nbsp; &nbsp;end;<br> &nbsp; &nbsp; &nbsp;//bsSkinListView1.Items.Add.Caption := InputString ;<br> &nbsp; &nbsp; &nbsp;bsSkinListView1.Items.Add.Caption := InputString ;<br> &nbsp; &nbsp; &nbsp;InputString := bsSkinInputDialog1.InputBox('输入信息','输入文件类型详细说明','*.*') ;<br> &nbsp; &nbsp; &nbsp;bsSkinListView1.Items.Item[bsSkinListView1.Items.Count -1].SubItems.Text := inputString;<br> &nbsp; &nbsp; &nbsp;//bsSkinListView1.Items.Add.SubItems.Add(inputString);<br> &nbsp; &nbsp; &nbsp;//bsSkinListView1.Columns.Items.Caption := InputString ;<br> &nbsp;end;<br>end;<br><br>procedure TForm1.bsSkinButton11Click(Sender: TObject);<br>begin<br>bsSkinTabSheet3.Visible:=true;<br>end;<br><br>procedure TForm1.bsSkinButton7Click(Sender: TObject);<br>begin<br>try<br> &nbsp;if Edit1.Text[length(Edit1.Text)] &lt;&gt; '/' then<br> &nbsp; &nbsp;Edit1.Text := Edit1.Text + '/'; //必须以 '/' 结尾<br> &nbsp;SearchFileThread := TSearchFileThread.Create(true);<br> &nbsp;SearchFileThread.MyDirName := Edit1.Text;<br> &nbsp;Animate1.Active := True ;<br> &nbsp;bsSkinListView2.Items.Clear ;<br> &nbsp;bsSkinButton9.Enabled := true ;<br> &nbsp;bsSkinButton7.Enabled := False ;<br> &nbsp;SumSearchFile := 0 ;<br> &nbsp;OverSearchFile := 0 ;<br> &nbsp;onoff := true ;<br> &nbsp;OnOff1 := true ;<br> &nbsp;SearchFileThread.Resume;<br> &nbsp;tempstring.Free ;<br>except &nbsp;// wrap up<br> &nbsp;Animate1.Active := false ;<br> &nbsp;form1.bsSkinButton7.Enabled := true ;<br> &nbsp;form1.bsSkinButton9.Enabled := false &nbsp;;<br>end; &nbsp; &nbsp;// try/finally<br>end;<br>procedure TForm1.bsSkinButton9Click(Sender: TObject);<br>begin<br> &nbsp;Animate1.Active := false ;<br> &nbsp;bsSkinButton7.Enabled := true ;<br> &nbsp;bsSkinButton9.Enabled := False ;<br> &nbsp;onoff := False ;<br> &nbsp;SearchFileThread.Terminate ;<br> &nbsp;Application.MessageBox( PChar('搜索完毕,共找到 '+inttostr(OverSearchFile )) , PChar('提示'), MB_OK +<br> &nbsp; &nbsp; MB_ICONINFORMATION + MB_TOPMOST);<br> &nbsp;SearchFileThread.Free ;<br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br> &nbsp;bsSkinData1.LoadFromFile(ExtractFilePath(Application.ExeName)+'/Circuit/skin.ini')<br>end;<br><br><br><br><br><br>procedure TForm1.N1Click(Sender: TObject);<br>begin<br>deletefile(ShowFileName) ;<br>end;<br><br>end.
 
我把你的代码考到我的Delphi7中<br>由于没有DFM文件<br>就把那些代码都去掉了<br>在我这儿没有提示出错<br>应该不是Execute本身的错误<br>如果实现不行就有笨方法<br>把所有代码都注释掉<br>一点一点的加<br>加到那出错,问题就在那附近
 

Similar threads

I
回复
0
查看
948
import
I
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
928
SUNSTONE的Delphi笔记
S
后退
顶部