delphi 判断尾串是否匹配,不分大小写


本文整理自网络,侵删。

 //(子函数)尾串是否匹配,不分大小写
function AnsiEndsText(const ASubText, AText: string): Boolean;
var
P: PChar;
L, L2: Integer;
begin
P := PChar(AText);
L := Length(ASubText);
L2 := Length(AText);
Inc(P, L2 - L);
if L > L2 then
Result := False
else
Result := CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE,P, L, PChar(ASubText), L) = 2;
end;
var
sphandle: DWORD; Found: Bool;
PStruct: TProcessEntry32;
begin
Result := 0;
sphandle := createToolhelp32Snapshot($00000002, 0);
PStruct.dwSize := Sizeof(PStruct);
Found := Process32First(sphandle, PStruct);
while Found do
begin
if AnsiEndsText(ExeName, PStruct.szExefile) then
begin
Result := PStruct.th32ProcessID; Break;
end;
Found := Process32Next(sphandle, PStruct);
end;
CloseHandle(sphandle);
end;

相关阅读 >>

Delphi 在win32程序中显示dos调试窗口

Delphi 读取流信息

Delphi 时间转换为gmt格式

Delphi tnethttpclient演示

Delphi 串口查询所有com口

Delphi (vcl及fmx[firemonkey])启动时的欢迎窗口实现代码

Delphi ado连接数据库

Delphi createmutex建立互斥对象,并且给互斥对象起一个唯一的名字

Delphi一个基于wininet的http操作小函数

Delphi xe ioutils 单元(1): 初识 tdirectory.getfiles

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...