Delphi公用函数单元文档格式.docx

上传人:b****3 文档编号:18431752 上传时间:2022-12-16 格式:DOCX 页数:66 大小:37KB
下载 相关 举报
Delphi公用函数单元文档格式.docx_第1页
第1页 / 共66页
Delphi公用函数单元文档格式.docx_第2页
第2页 / 共66页
Delphi公用函数单元文档格式.docx_第3页
第3页 / 共66页
Delphi公用函数单元文档格式.docx_第4页
第4页 / 共66页
Delphi公用函数单元文档格式.docx_第5页
第5页 / 共66页
点击查看更多>>
下载资源
资源描述

Delphi公用函数单元文档格式.docx

《Delphi公用函数单元文档格式.docx》由会员分享,可在线阅读,更多相关《Delphi公用函数单元文档格式.docx(66页珍藏版)》请在冰豆网上搜索。

Delphi公用函数单元文档格式.docx

functionYzGetMonth(Date:

{取日期天数分量}

functionYzGetDay(Date:

{取时间小时分量}

functionYzGetHour(Time:

TTime):

{取时间分钟分量}

functionYzGetMinute(Time:

{取时间秒钟分量}

functionYzGetSecond(Time:

{返回时间分量字符串}

functionYzGetTimeStr(ATime:

TTime;

AFlag:

{返回日期时间字符串}

functionYzGetDateTimeStr(ATime:

ADate:

{获取计算机名称}

functionYzGetComputerName():

{通过窗体子串查找窗体}

procedureYzFindSpecWindow(ASubTitle:

string);

{判断进程CPU占用率}

procedureYzJudgeCPU(ProcessName:

CPUUsage:

Single);

{分割字符串}

procedureYzSeparateTerms(Source:

Separator:

Char;

Terms:

{切换页面控件的活动页面}

procedureYzGotoNewPage(AOwerPage:

TPageControl;

ANewPage:

TTabSheet);

{设置页面控件标签的可见性}

procedureYzSetTableVisible(PageControl:

ShowFlag:

Boolean);

{根据产品名称获取产品编号}

functionYzGetLevelCode(AName:

string;

ProductList:

TStringList):

{取文件的主文件名}

functionYzGetMainFileName(AFileName:

{按下一个键}

procedureYzPressOneKey(AByteCode:

Byte);

overload;

{按下一个指定次数的键}

Byte;

ATimes:

Integer);

{按下二个键}

procedureYzPressTwoKeys(AFirstByteCode,ASecByteCode:

{按下三个键}

procedureYzPressThreeKeys(AFirstByteCode,ASecByteCode,AThirdByteCode:

{创建桌面快捷方式}

procedureYzCreateShortCut(constsPath:

sShortCutName:

WideString);

{删除桌面快捷方式}

procedureYzDeleteShortCut(sShortCutName:

{通过光标位置进行鼠标左键单击}

procedureYzMouseLeftClick(X,Y:

{鼠标左键双击}

procedureYzMouseDoubleClick(X,Y:

{通过窗口句柄进行鼠标左键单击}

procedureYzMouseLeftClick(lpClassName,lpWindowName:

PAnsiChar);

{通过光标位置查找窗口句柄}

functionYzWindowFromPoint(X,Y:

THandle;

{等待窗口在指定时间后出现}

functionYzWaitWindowExist(lpClassName,lpWindowName:

PAnsiChar;

ASecond:

Integer=0):

{通光标位置,窗口类名与标题查找窗口是否存在}

functionYzWaitWindowExist(X,Y:

AClassName,AWinName:

THandle;

overload;

{等待指定窗口消失}

procedureYzWaitWindowClose(lpClassName,lpWindowName:

Integer=0);

{通过窗口句柄设置文本框控件文本}

procedureYzSetEditText(lpClassName,lpWindowName:

AText:

{通过光标位置设置文本框控件文本}

procedureYzSetEditText(X,Y:

AText:

{获取Window操作系统语言}

functionYzGetWindowsLanguageStr:

String;

{清空动态数组}

procedureYzDynArraySetZero(varA);

{动态设置屏幕分辨率}

functionYzDynamicResolution(X,Y:

WORD):

Boolean;

{检测系统屏幕分辨率}

functionYzCheckDisplayInfo(X,Y:

type

TFontedControl=class(TControl)

public

propertyFont;

end;

TFontMapping=record

SWidth:

SHeight:

FName:

FSize:

procedureYzFixForm(AForm:

TForm);

procedureYzSetFontMapping;

{---------------------------------------------------

以下是关于获取系统软件卸载的信息的类型声明和函数

----------------------------------------------------}

TUninstallInfo=arrayofrecord

RegProgramName:

ProgramName:

UninstallPath:

Publisher:

PublisherURL:

Version:

HelpLink:

UpdateInfoURL:

RegCompany:

RegOwner:

{GetUninstallInfo返回系统软件卸载的信息}

functionYzGetUninstallInfo:

TUninstallInfo;

{检测Java安装信息}

functionYzCheckJavaInfo(AUninstallInfo:

CheckJava6:

Boolean=False):

{窗口自适应屏幕大小}

procedureYzAdjustForm(Form:

TForm;

constOrgWidth,OrgHeight:

integer);

{设置窗口为当前窗体}

procedureYzBringMyAppToFront(AppHandle:

THandle);

{获取文件夹大小}

functionYzGetDirSize(Dir:

SubDir:

Boolean):

LongInt;

{获取文件夹文件数量}

functionYzGetDirFiles(Dir:

{获取文件大小(KB)}

functionYzGetFileSize(constFileName:

String):

{获取文件大小(字节)}

functionYzGetFileSize_Byte(constFileName:

{算术舍入法的四舍五入取整函数}

functionYzRoundEx(constValue:

Real):

{弹出选择目录对话框}

functionYzSelectDir(constiMode:

integer;

constsInfo:

{获取指定路径下文件夹的个数}

procedureYzListFolders(constPath:

constShowPath:

varList:

{禁用窗器控件的所有子控件}

procedureYzSetSubCtlState(AOwer:

TWinControl;

AState:

{模拟键盘按键操作(处理字节码)}

procedureYzFKeyent(byteCard:

byte);

{模拟键盘按键操作(处理字符串}

procedureYzFKeyent(strCard:

{锁定窗口位置}

procedureYzLockWindow(ClassName,WinName:

PChar;

poX,poY:

{注册一个DLL形式或OCX形式的OLE/COM控件

参数strOleFileName为一个DLL或OCX文件名,

参数OleAction表示注册操作类型,1表示注册,0表示卸载

返回值True表示操作执行成功,False表示操作执行失败

}

functionYzRegisterOleFile(strOleFileName:

STRING;

OleAction:

Byte):

BOOLEAN;

functionYzListViewColumnCount(mHandle:

THandle):

functionYzGetListViewText(mHandle:

mStrings:

TStrings):

{删除目录树}

functionYzDeleteDirectoryTree(Path:

{Jpg格式转换为bmp格式}

functionJpgToBmp(Jpg:

TJpegImage):

TBitmap;

{设置程序自启动函数}

functionYzSetAutoRun(AFilePath:

{检测URL地址是否有效}

functionYzCheckUrl(url:

{获取程序可执行文件名}

functionYzGetExeFName:

{目录浏览对话框函数}

functionYzBrowseFolder(AOwer:

ATitle:

{重启计算机}

functionYzShutDownSystem(AFlag:

BOOL;

{程序运行后删除自身}

procedureYzDeleteSelf;

{程序重启}

procedureYzAppRestart;

{压缩Access数据库}

functionYzCompactAccessDB(constAFileName,APassWord:

{标题:

获取其他进程中TreeView的文本}

functionYzTreeNodeGetNext(mHandle:

mTreeItem:

HTreeItem):

HTreeItem;

functionYzTreeNodeGetLevel(mHandle:

functionYzGetTreeViewText(mHandle:

{获取本地ApplicationData目录路径}

functionYzLocalAppDataPath:

{获取Windows当前登录的用户名}

functionYzGetWindwosUserName:

{枚举托盘图标}

functionYzEnumTrayNotifyWnd(AFindList:

TStringList;

ADestStr:

BOOL;

{获取SQLServer用户数据库列表}

procedureYzGetSQLServerDBList(ADBHostIP,ALoginPwd:

ADBList:

{读取据库中所有的表}

procedureYzGetTableList(ConncetStr:

ATableList:

{将域名解释成IP地址}

functionYzDomainToIP(HostName:

{等待进程结束}

procedureYzWaitProcessExit(AProcessName:

{移去系统托盘失效图标}

procedureYzRemoveDeadIcons();

{转移程序占用内存至虚拟内存}

procedureYzClearMemory;

{检测允许试用的天数是否已到期}

functionYzCheckTrialDays(AllowDays:

{指定长度的随机小写字符串函数}

functionYzRandomStr(aLength:

Longint):

var

FontMapping:

arrayofTFontMapping;

implementation

uMain;

FileStream:

TFileStream;

LogFile:

begin

try

{每天一个日志文件}

Msg:

='

['

+DateTimeToStr(Now)+'

]'

+Msg;

=ExtractFilePath(Application.ExeName)+'

/Logs/'

+DateToStr(Now)+'

.log'

;

ifnotDirectoryExists(ExtractFilePath(LogFile))then

CreateDir(ExtractFilePath(LogFile));

ifFileExists(LogFile)then

FileStream:

=TFileStream.Create(LogFile,fmOpenWriteorfmShareDenyNone)

else

=TFileStream.Create(LogFile,fmCreateorfmShareDenyNone);

FileStream.Position:

=FileStream.Size;

=Msg+#13#10;

FileStream.Write(PChar(Msg)^,Length(Msg));

FileStream.Free;

except

end;

procedureYZDelayTime(MSecs:

FirstTickCount,Now:

Longint;

FirstTickCount:

=GetTickCount();

repeat

Application.ProcessMessages;

Now:

until(Now-FirstTickCount>

=MSecs)or(Now<

FirstTickCount);

I:

ifStr='

'

then

begin

Result:

=False;

Exit;

forI:

=1tolength(str)do

ifnot(Str[I]in['

0'

..'

9'

])then

=True;

HFileRes:

HFILE;

=false;

ifnotFileExists(fName)thenexit;

HFileRes:

=CreateFile(pchar(fName),GENERIC_READorGENERIC_WRITE,0,nil,

OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);

=(HFileRes=INVALID_HANDLE_VALUE);

ifnotResultthenCloseHandle(HFileRes);

TmpList:

TmpList:

=TStringList.Create;

forI:

=0toAList.Count-1do

ifAList.Strings[I]<

>

'

thenTmpList.Add(AList.Strings[I]);

AList.Clear;

AList.Text:

=TmpList.Text;

TmpList.Free;

ifExtractFileName(AList.Strings[I])<

Thumbs.db'

TmpList.Add(AList.Strings[I]);

{-------------------------------------------------------------

功能:

返回一个整数指定位数的带"

字符串

参数:

Value:

要转换的整数ALength:

字符串长度

返回值:

string

--------------------------------------------------------------}

I,ACount:

=

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > PPT模板 > 动态背景

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1