if (attr and faSysfile)=faSysfile then ... //
系统
if (attr and faArchive)=faArchive then ... //
存档
if (attr and faHidden)=faHidden then ... //
隐藏
◇[DELPHI]
执行程序外文件
WINEXEC//
调用可执行文件
winexec('command.com /c copy *.* c:\',SW_Normal);
winexec('start abc.txt');
ShellExecute 或 ShellExecuteEx//
启动文件关联程序
function executefile(const
filename,params,defaultDir:string;showCmd:integer):THandle;
ExecuteFile('C:\abc\a.txt','x.abc','c:\abc\',0);
ExecuteFile('http://tingweb.yeah.net','','',0);
ExecuteFile('mailto:tingweb@wx88.net','','',0);
◇[DELPHI]
取得系统运行的进程名
var hCurrentWindow:HWnd;szText:array[0..254] of char;
begin
hCurrentWindow:=Getwindow(handle,GW_HWndFrist);
while hCurrentWindow <> 0 do
begin
if Getwindowtext(hcurrnetwindow,@sztext,255)>0 then
listbox1.items.add(strpas(@sztext));
hCurrentWindow:=Getwindow(hCurrentwindow,GW_HWndNext);
end;
end;
◇[DELPHI]
关于汇编的嵌入
Asm End;
可以任意修改
EAX、ECX、EDX;不能修改 ESI、EDI、ESP、EBP、EBX
。
◇[DELPHI]
关于类型转换函数
FloatToStr//
浮点转字符串
FloatToStrF//
带格式的浮点转字符串
IntToHex//整数转 16
进制
TimeToStr
DateToStr
DateTimeToStr
FmtStr//
按指定格式输出字符串
FormatDateTime('YYYY-MM-DD,hh-mm-ss',DATE);
◇[DELPHI]
字符串的过程和函数
Insert(obj,target,pos);//字符串 target 插入在 pos 的位置。如插入结果大于 target 最大长度,多出
字符将被截掉。如
Pos 在 255 以外,会产生运行错。例如,st:='Brian',则 Insert('OK',st,2)会使 st
变为
'BrOKian'
。
Delete(st,pos,Num);//从 st 串中的 pos(整型)位置开始删去个数为 Num(整型)个字符的子字串。例如,
st:='Brian',则 Delete(st,3,2)将变为 Brn
。
Str(value,st);//将数值 value(整型或实型)转换成字符串放在 st 中。例如,a=2.5E4 时,则
str(a:10,st)将使 st 的值为' 25000'
。
Val(st,var,code);//把字符串表达式 st 转换为对应整型或实型数值,存放在 var 中。St 必须是一个表示数
值的字符串,并符合数值常数的规则。在转换过程中,如果没有检测出错误,变量
code 置为 0,否则置为第一个
出错字符的位置。例如,
st:=25.4E3,x 是一个实型变量,则 val(st,x,code)将使 X 值为 25400,code 值为
0
。
Copy(st.pos.num);//返回 st 串中一个位置 pos(整型)处开始的,含有 num(整型)个字符的子串。如果
pos 大于 st 字符串的长度,那就会返回一个空串,如果 pos 在 255 以外,会引起运行错误。例如,
st:='Brian',则 Copy(st,2,2)返回'ri'
。
Concat(st1,st2,st3……,stn);//把所有自变量表示出的字符串按所给出的顺序连接起来,并返回连接后的值。
如果结果的长度
255,将产生运行错误。例如,st1:='Brian',st2:=' ',st3:='Wilfred',则