Delphi中读取Outlook的数据,代码如下: [crayon-67683bddac6c157258822 […]
9月 172013
Delphi中读取Outlook的数据,代码如下: [crayon-67683bddac6c157258822 […]
1. 在子函数中引用全局变量,错误描述:在一个公共文件中定义了一个$dblink对象用于访问数据库,在另外 […]
1. 写子风格的时候,子风格和父风格之间无空格,如:#contactonline.co_row_comment […]
AlertDialog直接继承自Dialog类,可以用于显示确认提示框或者列表选择框,还可以用于显示有自定 […]
如何使用:在Eclipse中,打开项目下的res\values目录,在values上右键,新建->O […]
其他注意事项: 1、如何设置自己的Dialogfragment没有标题栏? 可以通过两种方法来设 […]
1. 今天check out项目的时候,svn突然报了一个如下错误: [crayon-67683bddad5c […]
如果你只有一个有线路由器,手机无法通过wifi上网,或者你在公司没有无线网络,那么你可以通过以下方法创建一个自 […]
When we begin to run a android application, eclipse som […]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, StrUtils; type TForm1 = class(TForm) Edit1: TEdit; Edit2: TEdit; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; function FindFlatFileInParentDir(curPath, sFile: string): string; function FindFlatFile(curPath, sFile: string): string; implementation {$R *.dfm} function FindFlatFileInParentDir(curPath, sFile: string): string; var pntPath: string; FilePath: string; I: Integer; begin pntPath := curPath; While true do begin FilePath := FindFlatFile(pntPath, sFile); if FilePath <> '' then begin Result := FilePath; Break; end else begin if Length(pntPath) <= 3 then Break; if RightStr(pntPath, 1) = '' then Delete(pntPath, length(pntPath), 1); for I := Length(pntPath) downto 1 do begin if pntPath[I] = '' then begin Delete(pntPath, I, Length(pntPath)); Break; end; end; end; end; end; function FindFlatFile(curPath, sFile: string): string; var sRec: TSearchRec; sRetCode: Integer; sPath: string; begin FillChar(sRec, SizeOf(sRec), #0); sPath := curPath; if RightStr(sPath, 1) <> '' then sPath := sPath + ''; sRetCode := FindFirst(sPath + '*.*', faAnyFile, sRec); While sRetCode = 0 do begin if (sRec.Attr and not faDirectory = 0) and (sRec.Name <> '.') and (sRec.Name <> '..') then Result := FindFlatFile(sPath + sRec.Name, sFile) else begin if AnsiEndsText(sRec.Name, sFile) then begin Result := sPath + sRec.Name ; Break; end else begin end; end; sRetCode := FindNext(sRec); end; end; procedure TForm1.Button1Click(Sender: TObject); begin Caption := FindFlatFileInParentDir(Edit1.Text, Edit2.Text); end; end. |