📄 ucustommodule.pas
字号:
Parameter:
Null
Return value:
None
Example:
HideFormOnTask();
}
//Note: The procedure must been called when the main from create
procedure HideFormOnTask();
//-------------------------------//
//24. Convert BMP to JPG
//-------------------------------//
{
Function:
Convert BMP to JPG
Parameter:
sFileName: The bmp picture file what want to convert
sToFileName: Converted file name and path
Return value:
None
Example:
ConvertBMPtoJPG('c:\a.bmp','d:\b');
}
procedure ConvertBMPtoJPG(const sFileName, sToFileName: string);
//-------------------------------//
//25. Convert JPG to BMP
//-------------------------------//
{
Function:
Convert JPG to BMP
Parameter:
sFileName: The jpg picture file what want to convert
sToFileName: Converted file name and path
Return value:
None
Example:
ConvertJPGtoBMP('c:\a.jpg','d:\b');
}
procedure ConvertJPGtoBMP(const sFileName, sToFileName: string);
//-------------------------------//
//26. Replace string in source
//-------------------------------//
{
Function:
Replace string in source
Parameter:
S: String will been replaced
source: Source sub-string
target: Target sub-string
Return value:
Replaced result
Example:
Replacing(sTest, 'LiuJinXiong', 'Apollo');
}
function Replacing(S, source, target: string): string;
//-------------------------------//
//27. Change numeric to chinese string
//-------------------------------//
{
Function:
Change numeric to chinese string
Parameter:
small: Numeric what to be changed
iPosition: Reserved long
Return value:
Result string
Example:
SmallTOBig(12345.78, -2);
}
function SmallTOBig(const small: real; const iPosition: integer): string;
//-------------------------------//
//28. Create short cut
//-------------------------------//
{
Function:
Create a short cut on desktop for program
Parameter:
sExePath: Files path and name
sShortCutName: Short cut name
Return value:
None
Example:
CreateShortCut('D:\a.txt', '测试文件');
}
procedure CreateShortCut(const sPath: string; sShortCutName: WideString);
//-------------------------------//
//29. Add file to document
//-------------------------------//
{
Function:
Add file to document
Parameter:
sPath: File path and name
Return value:
None
Example:
myAddDocument('C:\test.doc');
}
procedure myAddDocument(const sPath: string);
//-------------------------------//
//30. Get files icon
//-------------------------------//
{
Function:
Get files icon
Parameter:
Filename: File path which icon will been gotten
SmallIcon: If true will get 16*16 size icon, false will get 32*32 size icon
Return value:
Icon's handle
Example:
frmTest.Icon.Handle := GetFileIcon('d:\test.doc', true);
image1.Picture.Icon.Handle := GetFileIcon('d:\test.doc', false);
}
function GetFileIcon(const Filename: string; SmallIcon: Boolean): HICON;
//-------------------------------//
//31.Get CDROM serial number
//-------------------------------//
{
Function:
Get CDROM serial number
Parameter:
Null
Return value:
CDROM serial number
Example:
GetCDROMNumber();
}
function GetCDROMNumber(): string;
//-------------------------------//
//32. Set CDROM auto run
//-------------------------------//
{
Function:
Set CDROM auto run
Parameter:
AAutoRun: if true CDROM will autorun, or not autorun
Return value:
None
Example:
SetCDAutoRun(true); //Autorun
SetCDAutoRun(false); //No autorun
}
procedure SetCDAutoRun(AAutoRun: Boolean);
//-------------------------------//
//33. Open CDROM
//-------------------------------//
{
Function:
Open CDROM
Parameter:
Null
Return value:
None
Example:
OpenCDROM();
}
procedure OpenCDROM();
//-------------------------------//
//34. Close CDROM
//-------------------------------//
{
Function:
Close CDROM
Parameter:
Null
Return value:
None
Example:
CloseCDROM();
}
procedure CloseCDROM();
//-------------------------------//
//35. Get disk total bytes and total free
//-------------------------------//
{
Function:
Get disk total bytes and total free
Parameter:
TheDrive: What the disk to be total
TotalBytes: Total bytes
TotalFree: Total free
Return value:
TotalBytes: Total bytes
TotalFree: Total free
Example:
var
TotalBytes: double;
TotalFree: double;
begin
GetDiskSizeAvail('c:\', TotalBytes, TotalFree);
ShowMessage(FloatToStr(TotalBytes));
ShowMessage(FloatToStr(TotalFree));
}
//Note: Total bytes bigger than 2G
procedure GetDiskSizeAvail(TheDrive: PChar; var TotalBytes, TotalFree: double);
//-------------------------------//
//36. Close CDROM
//-------------------------------//
{
Function:
Close CDROM
Parameter:
Null
Return value:
None
Example:
CloseCDROM();
}
procedure GetDiskSize(const sDriver: string; var TotalBytes, TotalFree: double);
//-------------------------------//
//37. Close CDROM
//-------------------------------//
{
Function:
Close CDROM
Parameter:
Null
Return value:
None
Example:
CloseCDROM();
}
function SystemBarCall(const iNumber:integer):Boolean;
//-------------------------------//
//38. Get user name
//-------------------------------//
{
Function:
Get user name
Parameter:
Null
Return value:
User name
Example:
GetUserName();
}
function GetUserNameAPI(): AnsiString;
//-------------------------------//
//39. Get windows product ID
//-------------------------------//
{
Function:
Get windows product ID
Parameter:
Null
Return value:
Windows product ID
Example:
GetWindowsProductID();
}
function GetWindowsProductID(): string;
//-------------------------------//
//40. Hide task bar
//-------------------------------//
{
Function:
Hide task bar
Parameter:
Null
Return value:
None
Example:
HideTaskbar();
}
procedure HideTaskbar();
//-------------------------------//
//41. Show task bar
//-------------------------------//
{
Function:
Show task bar
Parameter:
Null
Return value:
None
Example:
ShowTaskbar();
}
procedure ShowTaskbar();
//-------------------------------//
//42. Make folder tree
//-------------------------------//
{
Function:
Make folder tree then add to list
Parameter:
iMode: Control type, 1 meant ListBox, 2 meant Memo
objName: Object name
Return value:
None
Example:
Memo1.Clear;
ChDir(Edit1.Text);
MakeTree(2, Memo1);
-------------------
ListXox1.Clear;
ChDir(Edit1.Text);
MakeTree(1, ListBox1);
}
procedure MakeTree(const iMode: integer; const objName: TObject);
//-------------------------------//
//43. Create database DSN
//-------------------------------//
{
Function:
Create database DSN
Parameter:
sDsnName: DSN name
sDbPath: Database path and name
sDescription: About database describe
Return value:
True meant success, false meant fail
Example:
CreateDsn('Apollotest', 'C:\apollo.mdb', 'apollo test dsn');
}
function CreateDsn(const sDsnName, sDbPath, sDescription: string): Boolean;
//-------------------------------//
//44. Change Chinese to PinYin index
//-------------------------------//
{
Function:
Change Chinese to PinYin index
Parameter:
sChinese: A Chinsese string
Return value:
PinYin index
Example:
edtLove.Text := CnToPY('我爱刘韵');
}
function CnToPY(const sChinese: string): string;
//-------------------------------//
//45. Add program ico to IE
//-------------------------------//
{
Function:
Add program ico to IE
Parameter:
sExePath: Execute program path and name
sShowText: Show text when mouse move over it
sIcon: Show icons
sOverIcon: Show icons when the mouse move over it
Return value:
true: Setup success
false: Setup fail
Example:
AddIcoToIE('c:\HUBDOG.CHM', '帮助文件', 'c:\1.ico', 'c:\2.ico');
}
procedure AddIcoToIE(const sExePath, sShowText, sIcon, sOverIcon: string);
//-------------------------------//
//46. Set disk volume
//-------------------------------//
{
Function:
Set disk volume
Parameter:
sDriver: Which driver want to change volume
sLabel: Volume label
Return value:
true: Success
false: fail
Example:
SetVolume('C:', 'System');
}
function SetVolume(const sDriver, sLabel: string): Boolean;
//-------------------------------//
//47. Format floppy
//-------------------------------//
{
Function:
Format floppy
Parameter:
Null
Return value:
None
Example:
FormatFloppy();
}
function FormatFloppy(): Boolean;
//-------------------------------//
//48. Judge if Audio CD in CDROM
//-------------------------------//
{
Function:
Judge if Audio CD in CDROM
Parameter:
Drive: CDROM
Return value:
true: Is Audio CD
false: Isn't Audio CD
Example:
IsAudioCD('E');
}
function IsAudioCD(const Drive: Char): bool;
//-------------------------------//
//49. Play Audio CD
//-------------------------------//
{
Function:
Play Audio CD
Parameter:
Drive: CDROM
Return value:
true: Play okay
false: Play fail
Example:
PlayAudioCD('E');
}
function PlayAudioCD(const Drive: Char): bool;
//-------------------------------//
//50. Check drive if ready
//-------------------------------//
{
Function:
Check drive if ready
Parameter:
Drive: Floppy, Harddisk or CDROM
Return value:
true: Okay
false: No okay
Example:
DiskInDrive('A');
}
function DiskInDrive(Drive: Char): Boolean;
//-------------------------------//
//51. Check driver type
//-------------------------------//
{
Function:
Check driver type
Parameter:
sDriver: Disk
Return value:
Result about disk type
Example:
CheckDriverType('A');
}
function CheckDriverType(const sDriver: string): string;
//-------------------------------//
//52. Check file in use
//-------------------------------//
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -