??xml version="1.0" encoding="utf-8" standalone="yes"?>色爱av综合网,欧美扣逼视频,三区在线视频http://www.aygfsteel.com/keweibo/category/43927.html一? Java 多能 Delphi,Powerbuilder ... zh-cnSat, 07 Apr 2012 01:54:46 GMTSat, 07 Apr 2012 01:54:46 GMT60VCLSkinW三方包http://www.aygfsteel.com/keweibo/articles/373511.htmlKeKeSat, 07 Apr 2012 01:17:00 GMThttp://www.aygfsteel.com/keweibo/articles/373511.htmlhttp://www.aygfsteel.com/keweibo/comments/373511.htmlhttp://www.aygfsteel.com/keweibo/articles/373511.html#Feedback0http://www.aygfsteel.com/keweibo/comments/commentRss/373511.htmlhttp://www.aygfsteel.com/keweibo/services/trackbacks/373511.html按照如下步骤安装Q?
1、对于单个控ӞComponet-->install component..-->PAS或DCU文g-->installQ?
2、对于带*.dpk文g的控件包QFile-->Open(下拉列表框中?.dpk)-->install卛_Q?
3、对于带*.bpl文g的控件包QInstall Packages-->Add-->bpl文g名即可;
4、如果以上Install按钮为失效的话,试试Compile按钮Q?
5、是run time lib则在option下的packages下的runtimepackes加之?
如果~译时提C文件找不到的话Q一般是控g的安装目录不在Delphi的Lib目录中,
有两U方法可以解冻I
1、反安装的源文g拷入到Delphi的Lib目录下;
2、或者Tools-->Environment Options中把控g源代码\径加入到Delphi的Lib目录中即可? 注意Q所安装的控件是否与你所用的Delphi版本盔R应?
参考资料:http://zhidao.baidu.com/question/54630211.html?fr=ala0


Ke 2012-04-07 09:17 发表评论
]]>
Delphi遍历文g夹及子文件夹http://www.aygfsteel.com/keweibo/articles/321353.htmlKeKeWed, 19 May 2010 03:48:00 GMThttp://www.aygfsteel.com/keweibo/articles/321353.htmlhttp://www.aygfsteel.com/keweibo/comments/321353.htmlhttp://www.aygfsteel.com/keweibo/articles/321353.html#Feedback0http://www.aygfsteel.com/keweibo/comments/commentRss/321353.htmlhttp://www.aygfsteel.com/keweibo/services/trackbacks/321353.html

copy:http://www.jackfeng.com/archives/276/

{-------------------------------------------------------------------------------
q程?    MakeFileList 遍历文g夹及子文件夹
作?      SWGWEB
日期:      2007.11.25
参数:      Path,FileExt:string   1.需要遍历的目录 2.要遍历的文g扩展?br /> q回?    TStringList

   EgQListBox1.Items:= MakeFileList( 'E:\极品飞R','.exe') ;
       ListBox1.Items:= MakeFileList( 'E:\极品飞R','.*') ;
-------------------------------------------------------------------------------}
function MakeFileList(Path,FileExt:string):TStringList ;
var
sch:TSearchrec;
begin
Result:=TStringlist.Create;

if rightStr(trim(Path), 1) <> '\' then
    Path := trim(Path) + '\'
else
    Path := trim(Path);

if not DirectoryExists(Path) then
begin
    Result.Clear;
    exit;
end;

if FindFirst(Path + '*', faAnyfile, sch) = 0 then
begin
    repeat
       Application.ProcessMessages;
       if ((sch.Name = '.') or (sch.Name = '..')) then Continue;
       if DirectoryExists(Path+sch.Name) then
       begin
         Result.AddStrings(MakeFileList(Path+sch.Name,FileExt));
       end
       else
       begin
         if (UpperCase(extractfileext(Path+sch.Name)) = UpperCase(FileExt)) or (FileExt='.*') then
         Result.Add(Path+sch.Name);
       end;
    until FindNext(sch) <> 0;
    SysUtils.FindClose(sch);
end;
end;

------------------------------------------------------------------------------------------------------------------------------------

字符截取函数LeftStr, MidStr, RightStr
q几个函数都包含在StrUtils中,所以需要uses StrUtils;
假设字符串是 Dstr := ’Delphi is the BEST’, 那么
LeftStr(Dstr, 5) := ’Delph’
MidStr(Dstr, 6, 7) := ’i is th’
RightStr(Dstr, 6) := ’e BEST’

~~~~~~~~~~~~~~~~~~~~~~~~~
function RightStr
    (Const Str: String; Size: Word): String;
begin
  if Size > Length(Str) then Size := Length(Str) ;
  RightStr := Copy(Str, Length(Str)-Size+1, Size)
end;
function MidStr
    (Const Str: String; From, Size: Word): String;
begin
  MidStr := Copy(Str, From, Size)
end;
function LeftStr
    (Const Str: String; Size: Word): String;
begin
  LeftStr := Copy(Str, 1, Size)
end;

q几个函数经常结合Pos, Length, Copy使用




Ke 2010-05-19 11:48 发表评论
]]>
为TListBoxlgd水^滚动?/title><link>http://www.aygfsteel.com/keweibo/articles/321352.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Wed, 19 May 2010 03:45:00 GMT</pubDate><guid>http://www.aygfsteel.com/keweibo/articles/321352.html</guid><wfw:comment>http://www.aygfsteel.com/keweibo/comments/321352.html</wfw:comment><comments>http://www.aygfsteel.com/keweibo/articles/321352.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/keweibo/comments/commentRss/321352.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/keweibo/services/trackbacks/321352.html</trackback:ping><description><![CDATA[<div class="wmqeeuq" id="Zoom"> <span lang="EN-US"><font face="Times New Roman">Delphi</font></span><span style="font-family: 宋体;">?/span><span lang="EN-US"><font face="Times New Roman">TListBox</font></span><span style="font-family: 宋体;">lg会自动添加一 个垂直滚动条Q即当列表框的高度容U不下所有的列表条目Ӟ垂直滚动条就自动昄。但是,当条目的宽度大于列表框的宽度Ӟ水^滚动条不会自动显C。当?/span><span lang="EN-US"><font face="Times New Roman">, </font></span><span style="font-family: 宋体;">可以在列表框中加如水qx动条Q方法是在窗体的</span><span lang="EN-US"><font face="Times New Roman">OnCreate</font></span><span style="font-family: 宋体;">事g处理E序中加入如下代码:</span> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"><font face="Times New Roman">procedure TForm1.FormCreate(Sender: TObject);</font></span></p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"><font face="Times New Roman">var</font></span></p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"><font face="Times New Roman"><span>  </span>i, MaxWidth: integer;</font></span></p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"><font face="Times New Roman">begin</font></span></p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"><font face="Times New Roman"><span>  </span>MaxWidth := 0;</font></span></p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"><font face="Times New Roman"><span>  </span>for i := 0 to ListBox1.Items.Count - 1 do</font></span></p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"><font face="Times New Roman"><span>  </span>if MaxWidth < ListBox1.Canvas.TextWidth(ListBox1.Items.Strings[i]) then</font></span></p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"><font face="Times New Roman"><span>    </span>MaxWidth := ListBox1.Canvas.TextWidth(ListBox1.Items.Strings[i]);</font></span></p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"><font face="Times New Roman"><span>  </span>SendMessage(ListBox1.Handle, LB_SETHORIZONTALEXTENT, MaxWidth+2, 0);</font></span></p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"><font face="Times New Roman">end;</font></span></p> <span style="font-size: 10.5pt; font-family: 宋体;">q段代码先查扑ֈ表框中最长的条目的宽度(以象素点表示Q,然后</span><span style="font-size: 10.5pt; font-family: 'Times New Roman';" lang="EN-US">, </span><span style="font-size: 10.5pt; font-family: 宋体;">?/span><span style="font-size: 10.5pt; font-family: 'Times New Roman';" lang="EN-US">LB_SETHORIZONTALEXTENT</span><span style="font-size: 10.5pt; font-family: 宋体;">消息来设|列表框的水qx动条的宽度(以象素点表示Q,? 加两个额外的象素?/span><br /> <p align="right">Q出处:http://www2.delphifans.com/blog /more.asp?name=caixiaoming&id=392Q?/p> </div> <img src ="http://www.aygfsteel.com/keweibo/aggbug/321352.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/keweibo/" target="_blank">Ke</a> 2010-05-19 11:45 <a href="http://www.aygfsteel.com/keweibo/articles/321352.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Delphi中Format与FormatDateTime函数详解http://www.aygfsteel.com/keweibo/articles/321328.htmlKeKeWed, 19 May 2010 02:08:00 GMThttp://www.aygfsteel.com/keweibo/articles/321328.htmlhttp://www.aygfsteel.com/keweibo/comments/321328.htmlhttp://www.aygfsteel.com/keweibo/articles/321328.html#Feedback0http://www.aygfsteel.com/keweibo/comments/commentRss/321328.htmlhttp://www.aygfsteel.com/keweibo/services/trackbacks/321328.html

copy:http://hi.baidu.com/yunfanleo/blog/item/0c51d9cdbc0531550eb34558.html

Format是一个很常用Q却又似乎很烦的Ҏ(gu)Q本囑֯q个Ҏ(gu)的帮助进行一些翻译,让它有一个完整的概貌Q以 供大家查询之用:

首先看它的声明:
function Format(const Format: string; const Args: array of const): string; overload;

事实上FormatҎ(gu)有两个种形式Q另外一U是三个参数的,主要区别在于它是U程安全的,
但ƈ不多用,所以这里只对第一个介l:
function Format(const Format: string; const Args: array of const): string; overload;

Format参数是一个格式字W串Q用于格式化Args里面的值的。Args又是什么呢Q?br /> 它是一个变体数l,卛_里面可以有多个参敎ͼ而且每个参数可以不同?br /> 如以下例子:

Format('my name is %6s',['wind']);
q回后就是my name is wind

现在来看Format参数的详l情况:
Format里面可以写普通的字符Ԍ比如'my name is',但有些格式指令字W具有特D意义,比如"%6s"格式指oh以下的Ş式:
"%" [index ":"] ["-"] [width] ["." prec] type
它是?%"开?而以typel束Qtype表示一个具体的cd。中间是用来
格式化typecd的指令字W,是可选的?/font>

先来看看type,type可以是以下字W:
d 十制敎ͼ表示一个整型?br /> u 和d一h整型|但它是无W号的,而如果它对应的值是负的Q则q回时是一??2ơ方减去q个l对值的?如:
Format('this is %u',[Q?]);
q回的是Qthis is 4294967294

f 对应点?br /> e U学表示法,对应整型数和点敎ͼ比如
Format('this is %e',[-2.22]);
q回的是Qthis is -2.22000000000000E+000,{一下再说明如果数的精度羃?yu)?/font>

g q个只能对应点型,且它会将g多余的数L,比如
Format('this is %g',[02.200]);
q回的是Qthis is 2.2

n 只能对应点型,D{化ؓL的Ş式。看一个例子就明白?br /> Format('this is %n',[4552.2176]);
q回的是this is 4,552.22

注意有两点,一是只表示到小数后两位Q等一下说怎么消除q种情况, 二是Q即使小数没有被截断Q它也不会也像整数部分一h逗号来分开?/font>

m钱币cdQ但关于货币cd有更好的格式化方法,q里只是单的格式?另外它只对应于Q点?br /> Format('this is %m',[9552.21]);
q回Qthis is K?,552.21

p 对应于指针类型,q回的值是指针的地址Q以十六q制的Ş式来表示
例如Q?br /> var X:integer;
p:^integer;
begin
X:=99;
p:=@X;
Edit1.Text:=Format('this is %p',[p]);
end;
Edit1的内Ҏ(gu)Qthis is 0012F548

s 对应字符串类型,不用多说了吧
x 必须是一个整形|以十六进制的形式q回
Edit1.Text:=Format('this is %X',[15]);
q回是:this is F

cd讲述完毕Q下面介l格式化Type的指令:
[index ":"]q个要怎么表达呢,看一个例?br /> Format('this is %d %d',[12,13]);
其中W一?d的烦引是0Q第二个%d?Q所以字W显C的时候是q样 this is 12 13

而如果你q样定义Q?br /> Format('this is %1:d %0:d',[12,13]);
那么q回的字W串变成了this is 13 12。现在明白了吗,[index ":"] 中的index指示Args中参数显C的序q有一U情况,如果q样
Format('%d %d %d %0:d %d', [1, 2, 3, 4])
返? 2 3 1 2?/font>

如果你想q回的是1 2 3 1 4Q必这样定Q?br /> Format('%d %d %d %0:d %3:d', [1, 2, 3, 4])

但用的时候要注意Q烦引不能超出Args中的个数Q不然会引v异常?br /> Format('this is %2:d %0:d',[12,13]);
׃Args中只?2 13 两个敎ͼ所以Index只能??Q这里ؓ2错了[width] 指定被格式化的值占的宽度,看一个例子就明白?/font>

Format('this is %4d',[12]);
输出是:this is   12,q个是比较容易,不过如果Width的值小于参数的长度Q则没有效果?br /> 如:

Format('this is %1d',[12]);
输出是:this is 12

["-"]q个指定参数向左齐,和[width]合在一h可以看到效果Q?br /> Format('this is %-4d,yes',[12]);
输出是:this is 12   ,yes

["." prec] 指定_ֺQ对于QҎ(gu)效果最佻I
Format('this is %.2f',['1.1234]);
输出 this is 1.12
Format('this is %.7f',['1.1234]);
输出?this is 1.1234000

而对于整型数Q如果prec比如整型的位数小Q则没有效果反之比整形值的位数大,则会在整型值的前面?补之
Format('this is %.7d',[1234]);
输出是:this is 0001234]
         
对于字符型,刚好和整型值相反,如果prec比字W串型的长度大则没有效果Q反之比字符串型的长度小Q则会截断尾部的字符
Format('this is %.2s',['1234']);
输出?this is 12,而上面说的这个例子:

Format('this is %e',[-2.22]);
q回的是Qthis is -2.22000000000000E+000,怎么L多余?呢,q个p?/font>

Format('this is %.2e',[-2.22]);
    
好了Q第一个ȝ讲完了,应该对他的应用很熟?zhn)了?/font>

///////////////////////////////////////////////////////////////
?FormatDateTime的用?br /> 他的声明为:

function FormatDateTime(const Format: string; DateTime: TDateTime): string;
overload;

当然和Format一栯有一U,但这里只介绍常用的第一U?Format参数是一个格式化字符丌Ӏ? DateTime是时间类型。返回值是一U格式化后的字符?重点来看Format参数中的指o字符

c 以短旉格式昄旉Q即全部是数字的表示
FormatdateTime('c',now);
输出为:2004-8-7 9:55:40

d 对应于时间中的日期,日期是一位则昄一位,两位则显CZ?br /> FormatdateTime('d',now);
输出可能??1

dd 和d的意义一P但它始终是以两位来显C的
FormatdateTime('dd',now);
输出可能?1?1

ddd 昄的是星期?br /> FormatdateTime('ddd',now);
输出? 星期?/font>

dddd 和ddd昄的是一L。但上面两个如果在其他国家可能不一栗ddddd 以短旉格式昄q月?br /> FormatdateTime('ddddd',now);
输出为:2004-8-7

dddddd 以长旉格式昄q月?br /> FormatdateTime('dddddd',now);
输出为:2004q???/font>

e/ee/eee/eeee 以相应的位数昄q?br /> FormatdateTime('ee',now);
输出为:04 Q表C?4q_

m/mm/mmm/mmmm 表示?br /> FormatdateTime('m',now);
输出为:8
FormatdateTime('mm',now);
输出? 08
FormatdateTime('mmm',now);
输出? 八月
FormatdateTime('mmmm',now);
输出? 八月

和ddd/dddd 一P在其他国家可能不同yy/yyyy 表示q?br /> FormatdateTime('yy',now);
输出?04
FormatdateTime('yyyy',now);
输出?2004,

h/hh,n/nn,s/ss,z/zzz 分别表示时Q分Q秒,毫秒

t 以短旉格式昄旉
FormatdateTime('t',now);
输出?10:17

tt 以长旉格式昄旉
FormatdateTime('tt',now);
输出?0:18:46

ampm 以长旉格式昄上午q是下午
FormatdateTime('ttampm',now);
输出为:10:22:57上午

大概如此Q如果要在Format中加普通的字符Ԍ可以用双引号隔开那些特定义的字符Q这h通字W串中如果含Ҏ(gu) 的字W就不会被显CZؓ旉格式啦:
FormatdateTime('"today is" c',now);
输出为:today is 2004-8-7 10:26:58

旉中也可以?-"?\"来分开日期Q?br /> FormatdateTime('"today is" yy-mm-dd',now);
FormatdateTime('"today is" yy\mm\dd',now);
输出为: today is 04-08-07

也可以用":"来分开旉
FormatdateTime('"today is" hh:nn:ss',now);
输出为:today is 10:32:23

/////////////////////////////////////////////////////////////////
?FormatFloat的用?/font>

常用的声明:
function FormatFloat(const Format: string; Value: Extended): string; overload;

和上面一样Format参数为格式化指o字符QValue为ExtendedcdZ么是q个cdQ因为它是所有Q 点g表示范围最大的Q如果传入该Ҏ(gu)的参数比如Double或者其他,则可以保存不会超围?/font>

关键是看Format参数的用?br /> 0 q个指定相应的位数的指o?br />    比如Q?br /> FormatFloat('000.000',22.22);
输出的就?22.220

注意一点,如果整数部分?的个数小于Value参数中整数的位数Q则没有效果如:
FormatFloat('0.00',22.22);
输出的是Q?2.22

但如果小数部分的0于Value中小数的倍数Q则会截ȝ应的数和位数如Q?br /> FormatFloat('0.0',22.22);
输出的是Q?2.2
  
也可以在整数0中指定逗号Q这个整C数必d?个,才会有逗号出句
FormatFloat('0,000.0',2222.22);
输出是:2,222.2

如果q样
FormatFloat('000,0.0',2222.22);
它的输出q是Q?,222.2

注意它的规律,#?的用法一P目前我还没有出有什么不同?/font>

FormatFloat('##.##',22.22);
输出是:22.00

E U学表示法,看几个例子大概就明白?br /> FormatFloat('0.00E+00',2222.22);
输出?2.22E+03
FormatFloat('0000.00E+00',2222.22);
输出?2222.22E+00
FormatFloat('00.0E+0',2222.22);
22.2E+2
明白了吗Q全靠E双?来支配的?br />   
q个Ҏ(gu)q不难,大概是q样子了?/font>

上面三个Ҏ(gu)是很常用的,没有什么技巧,只要记得q些规范?yu)p了?/font>

ȝ一下Format的用?

Format('x=%d',[12]);//'x=12'//最普?br /> Format('x=%3d',[12]);//'x=12'//指定宽度
Format('x=%f',[12.0]);//'x=12.00'//点?br /> Format('x=%.3f',[12.0]);//'x=12.000'//指定数
Format('x=%8.2f'[12.0])//'x=12.00';
Format('x=%.*f',[5,12.0]);//'x=12.00000'//动态配|?br /> Format('x=%.5d',[12]);//'x=00012'//前面补充0
Format('x=%.5x',[12]);//'x=0000C'//十六q制
Format('x=%1:d%0:d',[12,13]);//'x=1312'//使用索引
Format('x=%p',[nil]);//'x=00000000'//指针
Format('x=%1.1e',[12.0]);//'x=1.2E+001'//U学记数?br /> Format('x=%%',[]);//'x=%'//得到"%"
S:=Format('%s%d',[S,I]);//S:=S+StrToInt(I);//q接字符?/font>



Ke 2010-05-19 10:08 发表评论
]]>
Delphi+Codesoft 7.0 http://www.aygfsteel.com/keweibo/articles/320939.htmlKeKeFri, 14 May 2010 00:12:00 GMThttp://www.aygfsteel.com/keweibo/articles/320939.htmlhttp://www.aygfsteel.com/keweibo/comments/320939.htmlhttp://www.aygfsteel.com/keweibo/articles/320939.html#Feedback0http://www.aygfsteel.com/keweibo/comments/commentRss/320939.htmlhttp://www.aygfsteel.com/keweibo/services/trackbacks/320939.html?http://download.csdn.net/source/876883

Delphi+Codesoft 7.0 调用条码格式文g打印


procedure TFormMain.btnPrintClick(Sender: TObject);
Var
s: string;
i : Integer;
BarApp,BarDoc,BarVars:Variant; // OLE 变量
Begin
if not FileExists(edtBClabelName.Text) then
begin
stat.Panels[2].Text := 'The Barcode Document is not Exists.';
ShowMessage('The Barcode Document is not Exists.');
Exit;
btnOpen.SetFocus;
end;

BarApp := CreateOleObject('lppx.Application');
//arApp.Visible:=True;
BarApp.Visible:=False;

BarDoc:=BarApp.ActiveDocument;
BarVars:=BarDoc.Variables;
BarDoc.Open(edtBClabelName.Text);

// 变量赋?br /> if chkParam.Checked then
begin
BarDoc.Variables.Item('var1').Value:= edtPN.Text;
BarDoc.Variables.Item('var2').Value:= edtPartName.Text;
BarDoc.Variables.Item('var3').Value:= edtDesc.Text;
end;

// 打印标签
Bardoc.Printlabel(seqty.Value);
// Feed
BarDoc.FormFeed;
// 关闭
Bardoc.Close;
BarApp.Quit;
End;

如果报Undeclare identified 'CreateOleObject' 错误Q?则引入ComObj 卛_


Ke 2010-05-14 08:12 发表评论
]]>
ODAC的安装和使用(odac570src_0.28)http://www.aygfsteel.com/keweibo/articles/320231.htmlKeKeThu, 06 May 2010 12:10:00 GMThttp://www.aygfsteel.com/keweibo/articles/320231.htmlhttp://www.aygfsteel.com/keweibo/comments/320231.htmlhttp://www.aygfsteel.com/keweibo/articles/320231.html#Feedback0http://www.aygfsteel.com/keweibo/comments/commentRss/320231.htmlhttp://www.aygfsteel.com/keweibo/services/trackbacks/320231.htmlODAC的安装和使用

我下载的ODAC版本是ODAC_5.70.0.28Q下載地址:http://www.delphifans.com/SoftView/SoftView_2131.html

我的Delphi?.0

   W一步:在odac570src_0.28\Source\Delphi7打开dac70.dpk,然后~译 

   W二步:打开dacvcl70.dpkQ然后编?/p>

   W三步:打开dcldac70.dpkQ然后编?/p>

   W四步:打开odac70.dpkQ然后编?/p>

   W五步:打开odacvcl70.dpkQ然后编译(如果你想要创建CLX应用E序的话Q那么就要单独编?nbsp;     OdacClx.pasQ?nbsp;

   W六步:打开dclodac70.dpkQ然后编译,然后点击“安装”?

在用或~译时也会出现这个错误,  解决Ҏ(gu)把{$I _TrialIntfOld.inc}注释掉就O(jin)K?/p>

Ke 2010-05-06 20:10 发表评论
]]>Delphi中关于文件、目录操作的函数 http://www.aygfsteel.com/keweibo/articles/313896.htmlKeKeThu, 25 Feb 2010 07:31:00 GMThttp://www.aygfsteel.com/keweibo/articles/313896.htmlhttp://www.aygfsteel.com/keweibo/comments/313896.htmlhttp://www.aygfsteel.com/keweibo/articles/313896.html#Feedback0http://www.aygfsteel.com/keweibo/comments/commentRss/313896.htmlhttp://www.aygfsteel.com/keweibo/services/trackbacks/313896.htmlDelphi中关于文件、目录操作的函数



来源Q大富翁



关于文g、目录操?



Chdir('c:\abcdir'); // 转到目录

Mkdir('dirname'); //建立目录

DirectoryExists('dirname') //判斷目錄是否存在

Rmdir('dirname'); //删除目录(目錄不存在會q?

GetCurrentDir; //取当前目录名Q无'\'

Getdir(0,s); //取工作目录名s:='c:\abcdir';

Deletfile('abc.txt'); //删除文g

Renamefile('old.txt','new.txt'); //文g更名

ExtractFilename(filelistbox1.filename); //取文件名

ExtractFileExt(filelistbox1.filename); //取文件后~





目录处理函数三则:DelTree,XCopy,Move



private

{ Private declarations }

procedure _XCopy(ASourceDir:String; ADestDir:String);

procedure _Move(ASourceDir:String; ADestDir:String);

procedure _DelTree(ASourceDir:String);



//----------------------------------------------------------

procedure TForm1._XCopy(ASourceDir:String; ADestDir:String);

var

FileRec:TSearchrec;

Sour:String;

Dest:String;

begin

Sour:=ASourceDir;

Dest:=ADestDir;



if Sour[Length(Sour)]<>'\' then Sour := Sour + '\';

if Dest[Length(Dest)]<>'\' then Dest := Dest + '\';



if not DirectoryExists(ASourceDir) then

begin

ShowMessage('来源目录不存?!');

exit;

end;



if not DirectoryExists(ADestDir) then

begin

ForceDirectories(ADestDir);

end;



if FindFirst(Sour+'*.*',faAnyfile,FileRec) = 0 then

repeat

if ((FileRec.Attr and faDirectory) <> 0) then

begin

if (FileRec.Name<>'.') and (FileRec.Name<>'..') then

begin

_XCopy(Sour+FileRec.Name,Dest+FileRec.Name);

end;

end

else

begin

CopyFile(PChar(Sour+FileRec.Name),PChar(Dest+FileRec.Name),false);

end;

until FindNext(FileRec)<>0;



FindClose(FileRec);



end;

//------------------------------------------------------------------

procedure TForm1._Move(ASourceDir:String; ADestDir:String);

var

FileRec:TSearchrec;

Sour:String;

Dest:String;

begin

Sour:=ASourceDir;

Dest:=ADestDir;



if Sour[Length(Sour)]<>'\' then Sour := Sour + '\';

if Dest[Length(Dest)]<>'\' then Dest := Dest + '\';



if not DirectoryExists(ASourceDir) then

begin

ShowMessage('来源目录不存?!');

exit;

end;



if not DirectoryExists(ADestDir) then

begin

ForceDirectories(ADestDir);

end;



if FindFirst(Sour+'*.*',faAnyfile,FileRec) = 0 then

repeat

if ((FileRec.Attr and faDirectory) <> 0) then

begin

if (FileRec.Name<>'.') and (FileRec.Name<>'..') then

begin

_XCopy(Sour+FileRec.Name,Dest+FileRec.Name);



_DelTree(Sour+FileRec.Name);



FileSetAttr(Sour+FileRec.Name,faArchive);

RemoveDir(Sour+FileRec.Name);

end;

end

else

begin

CopyFile(PChar(Sour+FileRec.Name),PChar(Dest+FileRec.Name),false);



FileSetAttr(Sour+FileRec.Name,faArchive);

deletefile(Sour+FileRec.Name);

end;

until FindNext(FileRec)<>0;



FindClose(FileRec);



FileSetAttr(Sour,faArchive);

RemoveDir(Sour);



end;

//-----------------------------------------------------------

procedure TForm1._DelTree(ASourceDir:String);

var

FileRec:TSearchrec;

Sour:String;

begin

Sour:=ASourceDir;

if Sour[Length(Sour)]<>'\' then Sour := Sour + '\';



if not DirectoryExists(ASourceDir) then

begin

ShowMessage('来源目录不存?!');

exit;

end;



if FindFirst(Sour+'*.*',faAnyfile,FileRec) = 0 then

repeat

//if (FileRec.Attr = faDirectory) then

if ((FileRec.Attr and faDirectory) <> 0) then

begin

if (FileRec.Name<>'.') and (FileRec.Name<>'..') then

begin

_DelTree(Sour+FileRec.Name);



FileSetAttr(Sour+FileRec.Name,faArchive);

RemoveDir(Sour+FileRec.Name);

end;

end

else

begin

FileSetAttr(Sour+FileRec.Name,faArchive);

deletefile(Sour+FileRec.Name);

end;

until FindNext(FileRec)<>0;



FindClose(FileRec);



FileSetAttr(Sour,faArchive);

RemoveDir(Sour);



end;





利用递归实现删除某一目录下所有文?br />


var Form1: TForm1;

rec_stack:array [1..30] of TSearchRec;

rec_pointer:integer;

Del_Flag:Boolean;

---------------------------------------------------------------

procedure TForm1.DeleteTree(s:string);

VAR searchRec:TSearchRec;

begin

if FindFirst(s+'\*.*', faAnyFile, SearchRec)=0 then

repeat

if (SearchRec.Name<>'.') and (SearchRec.Name<>'..') then

begin

if (SearchRec.Attr and faDirectory>0) then

begin

rec_stack[rec_pointer]:=SearchRec;

rec_pointer:=rec_pointer-1;

DeleteTree(s+'\'+SearchRec.Name);

rec_pointer:=rec_pointer+1;

SearchRec:=rec_stack[rec_pointer];

end

else

begin

try

FileSetAttr(s+'\'+SearchRec.Name,faArchive);

DeleteFile(s+'\'+SearchRec.Name);

except

Application.MessageBox(PChar('Delete file:'+s+'\'+SearchRec.Name+' Error!'),'Info',MB_OK);

Del_Flag:=False;

end;

end;

end;

until (FindNext(SearchRec)<>0);

FindClose(SearchRec);

if rec_pointer<30 then

begin

try

FileSetAttr(s,faArchive);

RemoveDir(s);

except

Application.MessageBox(PChar('Delete Directory:'+s+' Error!'),'Info',MB_OK);

Del_Flag:=False;

end;

end;

end;

---------------------------------------------------------

Del_Flag:=True;

rec_pointer:=30;

DeleteTree('c:\temp');

if Del_Flag then Application.MessageBox(PChar('目录c:\temp的内容已成功清除!'),'信息',MB_OK);





轻轻松松查找文g

在^常的~程当中Q经怼到查找某一个目录下某一cL件或者所有文件的问题Qؓ了适应不同的需要,我们l常不得不编写大量的cM的代码,有没有可能写一个通用的查找文件的E序Q找C个文件后p行处理的呢?q样我们只要~写处理文g的部分就可以了,不需要编写查找文件的部分Q答案是肯定的。下面的q个E序p实现q个功能Q?br />
//说明Q?br />
//TFindCallBack为回调函敎ͼFindFile函数扑ֈ一个匹配的文g之后׃调用q个函数?br />
//TFindCallBack的第一个参数找到的文g名,你在回调函数中可以根据文件名q行操作?br />
//TFindCallBack的第二个参数为找到的文g的记录信息,是一个TSearchRecl构?br />
//TFindCallBack的第三、四个参数分别ؓ军_是否l止文g的查找,临时军_是否查找某个子目录!

//FindFile的参敎ͼ

//W一个决定是否退出查找,应该初始化ؓfalseQ?br />
//W二个ؓ要查找\径;

//W三个ؓ文g名,可以包含Windows所支持的Q何通配W的格式Q默认所有的文g

//W四个ؓ回调函数Q默认ؓI?br />
//W五个决定是否查扑֭目录Q默认ؓ查找子目?br />
//W六个决定是否在查找文g的时候处理其他的消息Q默认ؓ处理其他的消?br />
//若有意见和徏议请E_MailQKingron@163.net





type

TFindCallBack=procedure (const filename:string;const info:TSearchRec;var bQuit,bSub:boolean);



procedure FindFile(var quit:boolean;const path: String;const filename:string='*.*';

proc:TFindCallBack=nil;bSub:boolean=true;const bMsg:boolean=true);

var

fpath: String;

info: TsearchRec;



procedure ProcessAFile;

begin

if (info.Name<>'.') and (info.Name<>'..') and ((info.Attr and faDirectory)<>faDirectory) then

begin

if assigned(proc) then

proc(fpath+info.FindData.cFileName,info,quit,bsub);

end;

end;



procedure ProcessADirectory;

begin

if (info.Name<>'.') and (info.Name<>'..') and ((info.attr and fadirectory)=fadirectory) then

findfile(quit,fpath+info.Name,filename,proc,bsub,bmsg);

end;



begin

if path[length(path)]<>'\' then

fpath:=path+'\'

else

fpath:=path;

try

if 0=findfirst(fpath+filename,faanyfile and (not fadirectory),info) then

begin

ProcessAFile;

while 0=findnext(info) do

begin

ProcessAFile;

if bmsg then application.ProcessMessages;

if quit then

begin

findclose(info);

exit;

end;

end;

end;

finally

findclose(info);

end;

try

if bsub and (0=findfirst(fpath+'*',faanyfile,info)) then

begin

ProcessADirectory;

while findnext(info)=0 do

ProcessADirectory;

end;

finally

findclose(info);

end;

end;

例子Q?br />
procedure aaa(const filename:string;const info:tsearchrec;var quit,bsub:boolean);

begin

form1.listbox1.Items.Add(filename);

quit:=form1.qqq;

bsub:=form1.checkbox1.Checked;

end;



procedure TForm1.Button1Click(Sender: TObject);

begin

listbox1.Clear;

qqq:=false;

button1.Enabled:=false;

findfile(qqq,edit1.text,edit2.text,aaa,checkbox1.checked,checkbox2.checked);

showmessage(inttostr(listbox1.items.count));

button1.Enabled:=true;

end;



procedure TForm1.Button2Click(Sender: TObject);

begin

qqq:=true;

end;

Ke 2010-02-25 15:31 发表评论
]]>
Delphi中TApplicationc?/title><link>http://www.aygfsteel.com/keweibo/articles/313634.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Mon, 22 Feb 2010 07:30:00 GMT</pubDate><guid>http://www.aygfsteel.com/keweibo/articles/313634.html</guid><wfw:comment>http://www.aygfsteel.com/keweibo/comments/313634.html</wfw:comment><comments>http://www.aygfsteel.com/keweibo/articles/313634.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/keweibo/comments/commentRss/313634.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/keweibo/services/trackbacks/313634.html</trackback:ping><description><![CDATA[Delphi是一U面向对象的~程语言Q由于它采用完全集成OOP的优点,因此使它成ؓ目前十分行的Windows开发工兗在Delphi包含的众? cMQTApplication是一个有着十分重要作用的类。TApplicationcL用于描述Delphi~制的应?a class="bluekey" target="_blank">E序</a>的一个类。通过对这个类的灵zd用可以编制许多有特点的程序。下面我们就丑և个这斚w的例子? <p>  1 当前WindowsE序是否被激z: </p> <p>  TapplicationcL一个属性——ActiveQ这个属性就可以描述当前q行的程序是否被Ȁz,成ؓWindows的焦炏V检的代码如下Q? </p> <pre> If Application.Active=False then<br /> ShowMessageQ?#8217;当前H口没有被激z?#8217;Q;<br /> </pre> <p>  2 取得当前E序的名Uͼ </p> <p>  TapplicationcȝEXEName属性可以返回这个可执行E序的完整文件名Q包含\径)。实现的代码如下所C: </p> <p>  ShowMessage(Application.ExeName); </p> <p>  3 改变E序极小化时的标? </p> <p> 如果(zhn)细心观察可以发玎ͼ一些程序的标题和程序的名称q不一_其是一些英文程序,H体的标题栏比较长,可以容纳比较多的文字Q而在最化Ӟ往往变成 了很的几个字母。这中间起作用的是TapplicationcȝTitle属性。这个属性决定了E序最化时的标题Q而窗口中标题栏的标题是由 Form的Caption属性来军_的。其代码如下Q?</p> <pre> Form1.Caption:=’ H口的标?#8217;;<br /> Application.Title:=’E序的标?#8217;;<br /> </pre> <p>  其实我们也可以在在程?a class="bluekey" target="_blank">设计</a>? 指定TapplicationcȝTitle属性倹{操作的Ҏ(gu)是在开发环境中拉下Project菜单,选择Options菜单时弹出如? (?的对话框。在q个对话框中的Title栏中填写E序的标题一样也可以辑ֈq种效果。ƈ且因Z般的工程文g都是以英文命名的Q所以程序运行过E中? 出的消息框中的标题是英文。但在指定了q个属性之后,q个E序的所有消息窗口的标题都变为Title的倹{这׃得程序看h更加完整?</p> <p>  4 指明E序的主H口 </p> <p>  Windowspȝ中的界面都是H口Q但一般来讲有一个主H口。Tapplication的MainForm属性就可以q回E序的主H口? </p> <p>  5 昄消息? </p> <p> Delphi有许多显C消息框的函Cq程Q比较常用的是ShowMessageQ它用v来虽然十分方便,但是却有一个问题,那就是这个消息框的按钮是? 英文昄的。如果要生成一个含有中文显C的按钮p求助于Tapplication的MessageBox函数了。这个函数的原Ş如下Q?</p> <p>  function MessageBox(Text, tion: Char; Flags: Longint): Integer; </p> <p>  在这个函CQ前两项分别是显C的提示信息和消息窗口的标题QFlags是一个长整|用来指定按钮的个数及功能。熟(zhn)Delphi的用户可能会注意刎ͼq个函数和Delphi 3所提供的同名函数有一点不同,那不是这个版本中字符串参数都以字W的形式l出Q而不再要求将其{化成指针。我们在使用时要注意加以区别? </p> <p>  Application.MessageBox(需要存盘吗Q?提示信息,MB_OKCANCEL)Q? q个语句在运行时昄的样式如? (? 所C? </p> <p>  最后就q个函数的返回g一些说明,实际上这个函数返回的是一个整型的数|而这个数Dpȝ指定了具体的含义Q比如:按下“定”按钮时返回的值是“1”Q而其它按钮的值列在表 1 中? </p> <p>  ?1 按钮的意义及pȝ中对其定义的? </p> <pre>按钮的意?按下此按钮时函数q回的?br /> IDABORT 3<br /> IDCANCEL 2<br /> IDIGNORE 5<br /> IDNO 7<br /> IDOK 1<br /> IDRETRY 4<br /> IDYES 6<br /> </pre> <p>  6 控制H口的尺? </p> <p>  一般可以用H口手柄来调整窗口的寸Q但是也可以用Application的事件来调整。实现的Ҏ(gu)是用以下两个q程Q? </p> <pre> Application.Minimized;<br /> Application.Restore;<br /> </pre> <p>  前一个过E用来将E序的主H口最化Q而后一个过E用来将最化的窗口恢复到原来的尺寸? </p> <p>  7 链接联机帮助文g </p> <p>  Application的CurrentHelpFile属性能够指定当前程序所用的联机帮助文g的文件名。这个属性经怸另一个方法联合在一起用。D例如下: </p> <pre> Application.HelpFile := 联机帮助文g?<br /> Application.HelpJump(联机帮助文g的主?#8217;)<br /> </pre> <p>  通过q一命ol合Q我们就能ɾpȝ弹出一个显C某主题的联机帮助文件? </p> <p>  8 在程序运行时动态地创徏H口 </p> <p>  一般情况下Q窗口是在设计时加入到工E项目中的,但是有时也需要我们在E序q行时动态地加入H口Q这p用到Application 的CreateFormq程QD例如下: </p> <pre> Form3:Tform3; //声明H口c?br /> Application.CreateForm(TForm3, Form3); //创徏H口<br /> </pre> <p>  9 l束E序 </p> <p>  虽然我们可以用关闭主H口的方法来关闭一个程序,但是更好的办法是用Application的Terminateq程。它能够起到更彻底地关闭E序的效果? </p> <p>  10 Destroy 属? </p> <p> 虽然Delphi提供了这一属?但是q不提倡用它,如果要终l程序就要调用Terminateq程Q而Destroyq程一般是用来在程序发生?zhn)挂? 来退出程序时才调用,有些cMWindows中的l束d功能。它不仅能关闭程序实例本w,而且q能释放E序所占用的资源,能够辑ֈ程序彻底清除出pȝ 的目的?</p> <img src ="http://www.aygfsteel.com/keweibo/aggbug/313634.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/keweibo/" target="_blank">Ke</a> 2010-02-22 15:30 <a href="http://www.aygfsteel.com/keweibo/articles/313634.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用鼠标拖动无标题H口,H口內放的是Imagehttp://www.aygfsteel.com/keweibo/articles/313591.htmlKeKeMon, 22 Feb 2010 03:48:00 GMThttp://www.aygfsteel.com/keweibo/articles/313591.htmlhttp://www.aygfsteel.com/keweibo/comments/313591.htmlhttp://www.aygfsteel.com/keweibo/articles/313591.html#Feedback0http://www.aygfsteel.com/keweibo/comments/commentRss/313591.htmlhttp://www.aygfsteel.com/keweibo/services/trackbacks/313591.html
interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ImgList, Menus, ExtCtrls, BmpRgn,  StdCtrls, IniFiles,
  Buttons;

type
  TForm1 = class(TForm)
    img1: TImage;
    bvl1: TBevel;
    lbl1: TLabel;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    procedure WMEraseBkGnd( Var Msg: TWMEraseBkGnd ); message WM_ERASEBKGND;
    procedure WMNCHitTest( Var msg: TWMNCHitTest ); message WM_NCHITTEST;
  public
    { Public declarations }
    procedure SetTheRegion;
    procedure AppException(Sender: TObject; E: Exception);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
// This routine takes care of drawing the bitmap on the form.
procedure TForm1.WMEraseBkGnd(var Msg: TWMEraseBkGnd);
var
  Brush: TBrush;
begin
  Brush := TBrush.Create;
  Brush.Color := Color;
  FillRect( Msg.DC, ClientRect, Brush.Handle);
  Brush.Free;
  with img1.Picture.Bitmap do
    BitBlt( Msg.DC, 0, 0, Width, Height, Canvas.Handle, 0, 0, SRCCOPY);
  Msg.Result := 1;
end;

// This routine takes care of letting the user move the form
// around on the desktop.
procedure TForm1.WMNCHitTest( var msg: TWMNCHitTest );
var
  i: integer;
  p: TPoint;
  AControl: TControl;
  MouseOnControl: boolean;
begin
  inherited;
  if msg.result = HTCLIENT then begin
    p.x := msg.XPos;
    p.y := msg.YPos;
    p := ScreenToClient( p);
    MouseOnControl := false;
    for i := 0 to ControlCount-1 do begin
      if not MouseOnControl
      then begin
        AControl := Controls[i];
        if ((AControl is TWinControl) or (AControl is TGraphicControl))
          and (AControl.Visible) then
        begin
             MouseOnControl := PtInRect( AControl.BoundsRect, p);
        end;
      end
      else
        break;
    end;
    if (not MouseOnControl) then
      msg.Result := HTCAPTION;
  end;
end;

procedure TForm1.SetTheRegion;
var
  HR: HRGN;
begin
  HR := BmpToRegion( Self, img1.Picture.Bitmap);
  SetWindowRgn( handle, HR, true);
  Invalidate;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
    Application.OnException := AppException;
    SetTheRegion;
end;

procedure TForm1.AppException(Sender: TObject; E: Exception);
begin
  Application.ProcessMessages;
  Application.ShowException(E);
  Application.Terminate;
end;

end.
注意:
(1) img1: TImage;的Visible屬性必須設|為false

(2) BmpRgn 為外部dcu文g,需要導?/strong>




Ke 2010-02-22 11:48 发表评论
]]>
Delphi 日誌a錄盔Rhttp://www.aygfsteel.com/keweibo/articles/313415.htmlKeKeFri, 19 Feb 2010 06:50:00 GMThttp://www.aygfsteel.com/keweibo/articles/313415.htmlhttp://www.aygfsteel.com/keweibo/comments/313415.htmlhttp://www.aygfsteel.com/keweibo/articles/313415.html#Feedback0http://www.aygfsteel.com/keweibo/comments/commentRss/313415.htmlhttp://www.aygfsteel.com/keweibo/services/trackbacks/313415.html var sBackupFile,sDir:string;
    vFile: Textfile;
begin
  sDir:='指定目錄';
  if Copy(sDir, Length(sDir), 1) <> '\' then
    sDir := sDir + '\';
  //sDir:=ExtractFilePath(Application.ExeName)+'\';
  ForceDirectories(sDir + 'TESTLOG');
  sBackupFile := sDir + 'TESTLOG\'+FormatDateTime('YYYYMMDDHH',now())+'.log';
  AssignFile(vFile, sBackupFile);
  if FileExists(sBackupFile) then
    Append(vFile)
  else
    Rewrite(vFile);
  if not Err then
      WriteLn(vFile, FormatDateTime('yyyy/mm/dd hh:mm:ss', Now) +' [Error ]' +' - ' + sTrlog)
  else
      WriteLn(vFile, FormatDateTime('yyyy/mm/dd hh:mm:ss', Now) +' [      ]' +' - ' + sTrlog);
  CloseFile(vFile);
end;


Ke 2010-02-19 14:50 发表评论
]]>
让delphi 的代码显C?-CnWizardshttp://www.aygfsteel.com/keweibo/articles/312580.htmlKeKeThu, 11 Feb 2010 06:48:00 GMThttp://www.aygfsteel.com/keweibo/articles/312580.htmlhttp://www.aygfsteel.com/keweibo/comments/312580.htmlhttp://www.aygfsteel.com/keweibo/articles/312580.html#Feedback0http://www.aygfsteel.com/keweibo/comments/commentRss/312580.htmlhttp://www.aygfsteel.com/keweibo/services/trackbacks/312580.html ======================
一、什么是 CnWizardsQ?br /> ======================

CnWizards ?CnPack 目l的d产品之一Q中文全U是 CnPack IDE 专家包,
英文全称?CnPack IDE WizardsQ简U?CnWizards。CnWizards 是一l集成在
Delphi/C++Builder/BDS ?IDE 中,用于增强 IDE 功能、提?IDE 的可用性及
开发效率的免费、开放源码工兗?/p>

==================================
二、CnWizards 主要面对哪类用户?
==================================

CnWizards 产品主要面对使用 Delphi 5 6 7、C++Builder 5 6 ?BDS 2005
2006、RAD Studio 2007 2009 2010 的开发者?br /> CnWizards 目前的发布版本包括简体中文、繁体中文、英三种语言?/p>

注:׃~译的兼Ҏ(gu)问题,对于 Delphi 2009QCnWizards 只支持其正式版即
12.0.3170.16989 或以上版本,而不支持低于此版本的内测版。如需要在内测?br /> 中安?CnWizardsQ需要获?CnWizards 的代码自行编译?/p>

==============================
三、CnWizards 主要有哪些功能?
==============================

CnWizards ?Delphi / C++Builder / BDS ?IDE 中提供了十多个可独立讄?br /> 子专Ӟ数十U功能,主要包括Q?/p>

* 代码输入助手
* 代码l构匚w高亮与画U?br /> * 增强的单元窗体列表功?br /> * TabOrder 讄专家
* H体设计器的动工具?br /> * MSDN 帮助集成功能
* 代码~辑器工h与功能扩?br /> * 工程相关的扩展功?br /> * lg面板多行昄支持
* H体|顶与折叠功?br /> * 源代码统计功?br /> * 引用单元清理
* 其他大量增强与改q?/p>

关于界面截图可参考:http://www.cnpack.org/images/cnwizards.gif
此外QCnWizards q附带下列独立运行的工P

* CnWizards 讄导入导出工具
* DFM H体转换工具
* IDE 配置备䆾/恢复和清除打开文g历史工具
* 调试信息输出单元 CnDebug 与调试信息查看器 CnDebugViewer
* ASCII 字符?br /> * IDE 外部专家理工具
* 源码模块关系分析工具

CnWizards 以与开源协议兼容的 CnPack 协议发布Q因而是开源、免费的?br /> M个h或商业团体可以免费?CnWizardsQ无需支付M费用?/p>

======================
四、关?CnPack 开发组
======================

CnPack 是由互联|上一中国程序员开发的开放源码的自由软g目Q当前主?br /> 的工作成果包?CnPack lg包、CnWizards 专家包以?CVSTracNT 错误跟踪p?br /> l等?009 q?CnPack 开发组成ؓ?Embarcadero 的技术合作伙伴?br /> CnPack 开发团队目前规模有 260 余hQƈ且还在不断发展壮大中?/p>

CnPack |站Qhttp://www.cnpack.org
CnPack 论坛Qhttp://bbs.cnpack.org
每日构徏版: http://www.cnpack.org/downbuilds.php
理员信: master@cnpack.org

======================
五、更新记?br /> ======================

0.9.5 ?Bug 修复ZQ较 0.9.4 的更斎ͼ

* 高亮当前标识W增加前景色与边框色的设|?br /> * 引用单元清理修正对inline处理p|的问题?br /> * 增加IDE讄为单核方式运行的选项?br /> * 修正BDS的嵌入式设计界面~辑器工h讄未保存的问题?br /> * 在BDS的嵌入式设计界面增加~辑器工h?br /> * ~辑器扩展修正复制ƈq加功能在D2010下导致ؕ码的问题?br /> * 其它的错误修正和改进?br />


相关下蝲:
CnWizards V0.9.5.554 安装E序 (已下?nbsp;7455 ?
CnWizards V0.9.5.554 源代码(包括 CnPack lg?CnVcl 内测版) (已下?nbsp;1355 ?

Ke 2010-02-11 14:48 发表评论
]]>
Delphi字符串函数大?/title><link>http://www.aygfsteel.com/keweibo/articles/312577.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Thu, 11 Feb 2010 06:07:00 GMT</pubDate><guid>http://www.aygfsteel.com/keweibo/articles/312577.html</guid><wfw:comment>http://www.aygfsteel.com/keweibo/comments/312577.html</wfw:comment><comments>http://www.aygfsteel.com/keweibo/articles/312577.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/keweibo/comments/commentRss/312577.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/keweibo/services/trackbacks/312577.html</trackback:ping><description><![CDATA[     摘要: ?http://chinaitpower.net/A/2005-01-18/105341.html uses StrUtils;【字W串函数大全?       首部 function AnsiResemblesText(const AText, AOther: string): Boolean;    &n...  <a href='http://www.aygfsteel.com/keweibo/articles/312577.html'>阅读全文</a><img src ="http://www.aygfsteel.com/keweibo/aggbug/312577.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/keweibo/" target="_blank">Ke</a> 2010-02-11 14:07 <a href="http://www.aygfsteel.com/keweibo/articles/312577.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Delphi 常用函數整理http://www.aygfsteel.com/keweibo/articles/312576.htmlKeKeThu, 11 Feb 2010 05:59:00 GMThttp://www.aygfsteel.com/keweibo/articles/312576.htmlhttp://www.aygfsteel.com/keweibo/comments/312576.htmlhttp://www.aygfsteel.com/keweibo/articles/312576.html#Feedback0http://www.aygfsteel.com/keweibo/comments/commentRss/312576.htmlhttp://www.aygfsteel.com/keweibo/services/trackbacks/312576.html Delphi提供的字W串函数里有一个Pos函数Q它的定义是Q?

function Pos(Substr: string; S: string): Integer;

它的作用是在字符串S中查扑֭W串SubstrQ返回值是Substr在S中第一ơ出现的位置Q如果没有找刎ͼq回gؓ0?

Ke 2010-02-11 13:59 发表评论
]]>
AssignFile Procedure Assigns a file handle to a binary or text filehttp://www.aygfsteel.com/keweibo/articles/312425.htmlKeKeTue, 09 Feb 2010 07:42:00 GMThttp://www.aygfsteel.com/keweibo/articles/312425.htmlhttp://www.aygfsteel.com/keweibo/comments/312425.htmlhttp://www.aygfsteel.com/keweibo/articles/312425.html#Feedback0http://www.aygfsteel.com/keweibo/comments/commentRss/312425.htmlhttp://www.aygfsteel.com/keweibo/services/trackbacks/312425.htmlvar
    myFile : TextFile;
    text : String;
    sFileName : String;
begin
    sFileName := 'F:/test.txt';
    AssignFile(myFile, sFileName);
    if FileExists(sFileName) then
        Append(myFile)
// 以追加的方式打开文g
    else
        ReWrite(myFile);

    Writeln(myFile, 'Hello World, By Bob!');
    Writeln(myFile, FormatDateTime('yyyy/mm/dd hh:nn:ss', now));
    CloseFile(myFile);

    ReSet(myFile);

    while not Eof(myFile) do
    begin
          Readln(myFile, text);
          showmessage(text);
    end;
   
    CloseFile(myFile);
end;



Ke 2010-02-09 15:42 发表评论
]]>Delphi快捷?/title><link>http://www.aygfsteel.com/keweibo/articles/312386.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Tue, 09 Feb 2010 00:52:00 GMT</pubDate><guid>http://www.aygfsteel.com/keweibo/articles/312386.html</guid><wfw:comment>http://www.aygfsteel.com/keweibo/comments/312386.html</wfw:comment><comments>http://www.aygfsteel.com/keweibo/articles/312386.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/keweibo/comments/commentRss/312386.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/keweibo/services/trackbacks/312386.html</trackback:ping><description><![CDATA[下面的快捷键大部分在Delphi的菜单中找不刎ͼ其中有一些还是非常有用的? <br /> Ctrl+PageUp 光标移x屏的W一行,屏幕不滚动? <br /> Ctrl+PageDown 光标移x屏的最后一行,屏幕不滚动? <br /> Ctrl+↓ 向下滚动屏幕Q光标跟随滚动不出本屏? <br /> Ctrl+↑ 向上滚动屏幕Q光标跟随滚动不出本屏? <br /> Ctrl+Shift+NUM 在光标行讄最多九(ji)个(f)时标志号Q对临时切换非常有用? 行的左边出C本书Q封面有NUMQ再按一ơ取消设|? <br /> Ctrl+NUM 直接光标蟩到NUM处,NUM是用Ctrl+Shift+NUM讄的标受? NUM不能用小键盘? <br /> Ctrl+Home 光标移x件头? <br /> Ctrl+End 光标移x件尾? <br /> Ctrl+B Buffer ListH口? Ctrl+I 同Tab键? Ctrl+M 同Enter键? Ctrl+N 同Enter键,但光标位|保持不变? <br /> Ctrl+T 删除光标双的一个单词? <br /> Ctrl+Y 删除光标所在行? <br /> Ctrl+Shift+↑ 光标在函C内时Q将光标快速移臛_前函数声明处? <br /> Ctrl+Shift+↓ 光标在函数声明行Ӟ光标快速移臛_数定义处? <br /> <strong>Ctrl+Shift+C 声明一个过E或函数后,直接生成q程或函数的名称、begin、end; </strong> <br /> Ctrl+Shift+E 光标在EditH口和ExplorerH口间切换? Ctrl+Shift+G 插入GUID? <br /> <strong>Ctrl+Shift+J 弹出Delphi语句提示H口Q选择所需语句自动完成一条语句? </strong><br /> Ctrl+Shift+T 在光标行加入To-Do注释? <br /> Ctrl+Shift+Y 删除光标之后x行末之间的文本? <br /> Ctrl+F3 Call StackH口? <br /> Ctrl+F4 {于File菜单中的CloseV? <br /> Ctrl+鼠标转轮 加速滚屏? <br /> Shift+F8 调试时弹出CPUH口? <br /> Shift+F10 {于鼠标右键QWindows快捷键)? <br /> Alt+F4 关闭所有编辑框中打开的源E序文gQ但不关闭项目? 讄Code Insight 模板Qbegin...end,以后只要输入beQ然后按ctrl+j可以匹配begin,end;但是从begin到相应的endQ就不知道了Q匹配括号之cȝ可以用alt+[,Alt+] 搜烦editor keyboard shortcuts可能可以扑ֈQ你自己看帮助吧? 在编E序?unit 右键菜单的properties /Code Insight 讄你喜Ƣ的M东东 ctr+j卛_? DELPHI IDE中部分操作快h?大部分在Delphi 5.0的菜单中找不刎ͼ其中有一些还是非常有用的) <br /> <strong>1 代码模板QCTRL+J</strong> <br /> <strong>2 代码整块UdQCTRL+SHIFT+IQ右U) CTRL+SHIFT+UQ左U) </strong>  <br /> 3 选中H体 Q?先选中M控gQSHIFT+鼠标左键 <br /> <strong>4 鼠标指向变量名、单元名、类名,再用 CTRL+鼠标左键 可找到相应的说明 </strong> <br /> <strong>5 在过E、函数、事件内部, SHIFT+CTRL+向上的方向键 可蟩跃到相应的过E、函数、事件的定义</strong> <br /> <strong>6 相反Q在q程、函数、事件的定义处,SHIFT+CTRL+向下的方向键 可蟩跃到具体q程、函数、事件内?/strong><br /> 7 CTRL+ SHIFT + C:~写x或者补上函? <br /> 8 SHIFT+CTRL+E 昄 EXPLORER <br /> 9 Ctrl+ shift + n (n=1,2,3,4......)定义书签 <br /> 10 Ctrl+ n (n=1,2,3,4......)跛_书签n <br /> 11 ALT+鼠标左键可以块选代码,删除寚w的重复代码非常有? <br /> 12 Ctrl+PageUp 光标移x屏的W一行,屏幕不滚动? <br /> 13 Ctrl+PageDown 光标移x屏的最后一行,屏幕不滚动? <br /> 14 Ctrl+↓ 向下滚动屏幕Q光标跟随滚动不出本屏? <br /> 15 Ctrl+↑ 向上滚动屏幕Q光标跟随滚动不出本屏? <br /> 16 Ctrl+Home 光标移x件头? <br /> 17 Ctrl+End 光标移x件尾? <br /> 18 Ctrl+B Buffer ListH口? <br /> 19 Ctrl+I 同Tab键? <br /> 20 Ctrl+M 同Enter键? <br /> 21 Ctrl+N 同Enter键,但光标位|保持不变? <br /> 22 Ctrl+T 删除光标双的一个单词? <br /> 23 Ctrl+Y 删除光标所在行? <br /> 24 Ctrl+Shift+↑ 光标在函C内时Q将光标快速移臛_前函数声明处? <br /> 25 Ctrl+Shift+↓ 光标在函数声明行Ӟ光标快速移臛_数定义处? <br /> 26 Ctrl+Shift+C 声明一个过E或函数后,直接生成q程或函数的名称、begin、end; <br /> 27 Ctrl+Shift+E 光标在EditH口和ExplorerH口间切换? <br /> 28 Ctrl+Shift+G 插入GUID? <br /> 29 Ctrl+Shift+J 弹出Delphi语句提示H口Q选择所需语句自动完成一条语句? <br /> 30 Ctrl+Shift+T 在光标行加入To-Do注释? <br /> 31 Ctrl+Shift+Y 删除光标之后x行末之间的文本? <br /> 32 Ctrl+F3 Call StackH口? <br /> 33 Ctrl+F4 {于File菜单中的CloseV? <br /> 34 Ctrl+鼠标转轮 加速滚屏? <br /> 35 Shift+F8 调试时弹出CPUH口? <br /> 36 Shift+F10 {于鼠标右键QWindows快捷键)? <br /> 37 Alt+F4 关闭所有编辑框中打开的源E序文gQ但不关闭项目? <br /> <strong>38 Ctrl+F 查找 , F3為查找下一?/strong><br /> <img src ="http://www.aygfsteel.com/keweibo/aggbug/312386.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/keweibo/" target="_blank">Ke</a> 2010-02-09 08:52 <a href="http://www.aygfsteel.com/keweibo/articles/312386.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在Delphi中可用FormatDateTime函数的用?/title><link>http://www.aygfsteel.com/keweibo/articles/312384.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Tue, 09 Feb 2010 00:44:00 GMT</pubDate><guid>http://www.aygfsteel.com/keweibo/articles/312384.html</guid><wfw:comment>http://www.aygfsteel.com/keweibo/comments/312384.html</wfw:comment><comments>http://www.aygfsteel.com/keweibo/articles/312384.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/keweibo/comments/commentRss/312384.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/keweibo/services/trackbacks/312384.html</trackback:ping><description><![CDATA[function FormatDateTime(const Format: string; DateTime: TDateTime): string; <br /> Format参数是一个格式化字符丌ӀDateTime是时间类型。返回值是一U格式化后的字符Ԍ重点来看Format参数中的指o字符Q?br /> c以短旉格式昄旉Q即全部是数字的表示<br /> FormatdateTime('c',now);<br /> 输出为:2004-8-7 9:55:40<br /> d 对应于时间中的日期,日期是一位则昄一位,两位则显CZ?br /> FormatdateTime('d',now);<br /> 输出可能??1<br /> dd 和d的意义一P但它始终是以两位来显C的<br /> FormatdateTime('dd',now);<br /> 输出可能?1?1<br /> ddd 昄的是星期?br /> FormatdateTime('ddd',now);<br /> 输出? 星期?br /> dddd 和ddd昄的是一L?br /> 但上面两个如果在其他国家可能不一栗?br /> ddddd 以短旉格式昄q月?<br /> FormatdateTime('ddddd',now);<br /> 输出为:2004-8-7<br /> dddddd 以长旉格式昄q月?br /> FormatdateTime('dddddd',now); <br /> 输出为:2004q???br /> e/ee/eee/eeee 以相应的位数昄q?br /> FormatdateTime('ee',now); <br /> 输出为:04 Q表C?4q_<br /> m/mm/mmm/mmmm 表示?br /> FormatdateTime('m',now);<br /> 输出为:8<br /> FormatdateTime('mm',now);<br /> 输出?08<br /> FormatdateTime('mmm',now);<br /> 输出?八月<br /> FormatdateTime('mmmm',now); <br /> 输出?八月<br /> 和ddd/dddd 一P在其他国家可能不?br /> yy/yyyy 表示q?br /> FormatdateTime('yy',now);<br /> 输出?04<br /> FormatdateTime('yyyy',now);<br /> 输出?2004<br /> h/hh,n/nn,s/ss,z/zzz 分别表示时Q分Q秒,毫秒<br /> t 以短旉格式昄旉<br /> FormatdateTime('t',now);<br /> 输出?10:17<br /> tt 以长旉格式昄旉<br /> FormatdateTime('tt',now);<br /> 输出?0:18:46<br /> ampm 以长旉格式昄上午q是下午<br /> FormatdateTime('ttampm',now);<br /> 输出为:10:22:57上午<br /> 如果要在Format中加普通的字符Ԍ可以用双引号隔开那些特定义的字符Q这h通字W串中如果含Ҏ(gu)的字W就不会被显CZؓ旉格式啦:<br /> FormatdateTime('"today is" c',now);<br /> 输出为:today is 2004-8-7 10:26:58<br /> 旉中也可以?-"?\"来分开日期Q?br /> FormatdateTime('"today is" yy-mm-dd',now);<br /> FormatdateTime('"today is" yy\mm\dd',now);<br /> 输出为: today is 04-08-07<br /> 也可以用":"来分开旉 <br /> FormatdateTime('"today is" hh:nn:ss',now);<br /> 输出为:today is 10:32:23 <img src ="http://www.aygfsteel.com/keweibo/aggbug/312384.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/keweibo/" target="_blank">Ke</a> 2010-02-09 08:44 <a href="http://www.aygfsteel.com/keweibo/articles/312384.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Delphi TIniFile c?操作ini配置文ghttp://www.aygfsteel.com/keweibo/articles/312322.htmlKeKeMon, 08 Feb 2010 06:36:00 GMThttp://www.aygfsteel.com/keweibo/articles/312322.htmlhttp://www.aygfsteel.com/keweibo/comments/312322.htmlhttp://www.aygfsteel.com/keweibo/articles/312322.html#Feedback0http://www.aygfsteel.com/keweibo/comments/commentRss/312322.htmlhttp://www.aygfsteel.com/keweibo/services/trackbacks/312322.html

?http://hi.baidu.com/graspa/blog/item/d17d928b4ec949d0fc1f1007.html/cmtid/196abb648679f0fcf73654ae

一、有必要了解INI文g的结构:

;注释

[节名]

关键??/font>

...

---- INI文g允许有多个小节,每个节又允许有多个关键字, “=”后面是该关键字的倹{?/font>

---- 值的cd有三U:字符丌Ӏ整型数值和布尔倹{其中字W串存贮在INI文g中时没有引号Q布?yu)真值用1表示Q布?yu)假值用0表示?/font>

---- 注释以分?#8220;;”开头?/font>

二、定?/font>

---- 1、在Interface的Uses节增加IniFilesQ?/font>

---- 2、在Var变量定义部分增加一行:

myinifile:Tinifile;

---- 然后Q就可以对变量myinifileq行创徏、打开、读取、写入等操作了?/font>

三、打开INI文g

myinifile:=Tinifile.create('program.ini');

--- 上面q一行语句将会ؓ变量myinifile与具体的文g program.ini建立联系Q然后,可以通过变量myinifileQ来dprogram.ini文g中的关键字的g?/font>

---- 值得注意的是Q如果括号中的文件名没有指明路径的话Q那么这个Program.ini文g会存储在Windows目录?把Program.ini文g存储在应用程序当前目录中的方法是Qؓ其指定完整的路径及文件名。下面的两条语句可以完成q个功能Q?/font>

Filename:=ExtractFilePath(Paramstr(0))+'program.ini';

myinifile:=Tinifile.Create(filename);

四、读取关键字的?/font>

--- 针对INI文g支持的字W串、整型数倹{布?yu)gU数据类型,TINIfilescL供了三种不同的对象方法来dINI文g中关键字的倹{?/font>

--- 假设已定义变量vs、vi、vb分别为string?integer、booleancd?/font>

vs:=myinifile.Readstring('节?,'关键?,~省?;

vi:=myinifile.Readinteger('节?,'关键?,~省?;

vb:=myinifile.Readbool('节?,'关键?,~省?;

--- 其中~省gؓ该INI文g不存在该关键字时q回的缺省倹{?/font>

五、写入INI文g

---- 同样的,TInifilecM提供了三U不同的对象Ҏ(gu)Q向INI文g写入字符丌Ӏ整型数及布?yu)类型的关键字?/font>

myinifile.writestring('节?,'关键?,变量或字W串?;

myinifile.writeinteger('节?,'关键?,变量或整型数?;

myinifile.writebool('节?,'关键?,变量或True或False);

---- 当这个INI文g不存在时Q上面的语句q会自动创徏该INI文g?/font>

六、删除关键字

---- 除了可用写入Ҏ(gu)增加一个关键字QTinifilec还提供了一个删除关键字的对象方法:

myinifile.DeleteKey('节?,'关键?);

七、小节操?/font>

--- 增加一个小节可用写入的Ҏ(gu)来完成,删除一个小节可用下面的对象Ҏ(gu)Q?/font>

myinifile.EraseSection('节?);

--- 另外Tinifilec还提供了三U对象方法来对小节进行操作:

--- myinifile.readsection('节?,TStrings变量);可将指定节中的所有关键字名读取至一个字W串列表变量中;

--- myinifile.readsections(TStrings变量);可将INI文g中所有小节名d至一个字W串列表变量中去?/font>

---- myinifile.readsectionvalues('节?,TStrings变量);可将INI文g中指定小节的所有行Q包括关键字?、|d至一个字W串列表变量中去?/font>

八、释?/font>

在适当的位|用下面的语句释放myinifileQ?/font>

myinifile.distory;

?ji)、一个实?/font>

---- 下面用一个简单的例子(如图)Q演CZ建立、读取、存贮INI文g的方法。myini.ini文g中包含有“E序参数”节Q和用户名称Q字W串Q、是? 正式用户Q布?yu)|和已q行旉Q整型|三个关键字。程序在H体建立dq些数据Qƈ在窗体释放时写myini.ini文g?/font>

--- 附源E序清单

unit Unit1;

interface

uses

Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

inifiles, //配置操作文g

StdCtrls, ExtCtrls;

type

TForm1 = class(TForm)

Edit1: TEdit;

CheckBox1: TCheckBox;

Edit2: TEdit;

Label1: TLabel;

Label2: TLabel;

Timer1: TTimer;

Label3: TLabel;

procedure FormCreate(Sender: TObject);

procedure FormDestroy(Sender: TObject);

procedure Timer1Timer(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

implementation

var

myinifile:TInifile;

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);

var

filename:string;

begin

filename:=ExtractFilePath(paramstr(0))+'myini.ini';

myinifile:=TInifile.Create(filename);

edit1.Text:= myinifile.readstring('E序参数','用户名称','~省的用户名U?);

edit2.text:= inttostr(myinifile.readinteger('E序参数','已运行时?,0));

checkbox1.Checked:= myinifile.readbool('E序参数','是否正式用户',False);

end;

procedure TForm1.FormDestroy(Sender: TObject);

begin

myinifile.writestring('E序参数','用户名称',edit1.Text);

myinifile.writeinteger('E序参数','已运行时?,strtoint(edit2.text));

myinifile.writebool('E序参数','是否正式用户',checkbox1.Checked);

myinifile.Destroy;

end;

procedure TForm1.Timer1Timer(Sender: TObject);

begin

edit2.Text:=inttostr(strtoint(edit2.text)+1);

end;

end.



Ke 2010-02-08 14:36 发表评论
]]>
վ֩ģ壺 | | Ͼ| Դ| | | | | ݸ| лͨ| | | | | | | | | פ| Ӻ| ʳ| ƽ| ʡ| С| | ɿ| | | Ѿ| ƽ̶| ػ| | | Ϳ| | żҸ| ˮ| | ȫ| | |