Delphi常用的函数库
Posted on 2008-10-17 23:21 长沙竹青
软件 阅读(120) 评论(0) 编辑 收藏 网摘 所属分类:
Delphi Delphi
常用的函数库,引用作者的话“今天在整理以前写过的代码,发现有些函数还是挺实用的,决定将其贴到Blog上,与众多好友一起分享。”
源文地址:blog.csdn.net/chris_mao/archive/2007/11/01/1862017.aspx
{*******************************************************************************
* 模块名称: 公用函数库
* 编写人员: Chris Mao
* 编写日期: 2004.10.30
******************************************************************************}
unit JrCommon;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ShellAPI, CommDlg, MMSystem, StdCtrls, Registry, JrConsts, Winsock;
//------------------------------------------------------------------------------
//窗体类函数
//------------------------------------------------------------------------------
function FindFormClass(FormClassName: PChar): TFormClass;
function HasInstance(FormClassName: PChar): Boolean;
//------------------------------------------------------------------------------
//公用对话框函数
//------------------------------------------------------------------------------
procedure InfoDlg(const Msg: String; ACaption: String = SInformation);
{ 信息对话框 }
procedure ErrorDlg(const Msg: String; ACaption: String = SError);
{ 错误对话框 }
procedure WarningDlg(const Msg: String; ACaption: String = SWarning);
{ 警告对话框 }
function QueryDlg(const Msg: String; ACaption: String = SQuery): Boolean;
{ 确认对话框 }
function QueryNoDlg(const Msg: string; ACaption: string = SQuery): Boolean;
{ 确认对话框,默认按钮为"否" }
function JrInputQuery(const ACaption, APrompt: String; var Value: string): Boolean;
{ 输入对话框 }
function JrInputBox(const ACaption, APrompt, ADefault: string): String;
{ 输入对话框 }
//------------------------------------------------------------------------------
//扩展文件目录操作函数
//------------------------------------------------------------------------------
procedure RunFile(const FileName: String; Handle: THandle = 0; Param: string = '');
{ 运行一个文件 }
function AppPath: string;
{ 应用程序路径 }
function GetProgramFilesDir: string;
{ 取Program Files目录 }
function GetWindowsDir: string;
{ 取Windows目录}
function GetWindowsTempPath: string;
{ 取临时文件路径 }
function GetSystemDir: string;
{ 取系统目录 }
//------------------------------------------------------------------------------
//扩展字符串操作函数
//------------------------------------------------------------------------------
function InStr(const sShort: string; const sLong: string): Boolean;
{ 判断s1是否包含在s2中 }
function IntToStrSp(Value: Integer; SpLen: Integer = 3; Sp: Char = ','): string;
{ 带分隔符的整数-字符转换 }
function ByteToBin(Value: Byte): string;
{ 字节转二进制串 }
function StrRight(Str: string; Len: Integer): string;
{ 返回字符串右边的字符 }
function StrLeft(Str: string; Len: Integer): string;
{ 返回字符串左边的字符 }
function Spc(Len: Integer): string;
{ 返回空格串 }
procedure SwapStr(var s1, s2: string);
{ 交换字串 }
//------------------------------------------------------------------------------
// 扩展日期时间