摘要:
{ 1 h=1*60 m=1*60*60 s=1*60*60*1000 hs=3600000hs}{时间 计时器 00:01:14}//label1.Caption:= StartCount();function StartCount():string;{$j+}consth:Integer=0;m:Integer=0;s:integer=0;{$j-}begininc(s);if s>=60 thenbeginInc(m);s:=0;end;if m>=60 thenbeginInc(h);m:=0;end;Result:=Format('%.2d:%.2d:%.2d 阅读全文
posted @ 2012-07-26 08:56
XE2011
阅读(382)
评论(0)
推荐(0)
摘要:
{获得磁盘驱动器序列号} function Get_HD_Serial(const Drivedir: Char): string; var Nu: DWORD; Vf: DWORD; VolumeInfo: array[0..MAX_PATH] of Char; V_n: DWORD; begin 阅读全文
posted @ 2012-07-26 08:50
XE2011
阅读(787)
评论(0)
推荐(0)
摘要:
{得到系统C:\Windows\system32 路径}//调用Edit1.text:=getSys32Path();function getSys32Path():string;varsPath : PCHAR ;beginGetMem(sPath,255);GetSystemDirectory(sPath,255);Result := sPath;//C:\Windows\system32end;通过 为知笔记 发布 阅读全文
posted @ 2012-07-26 08:50
XE2011
阅读(200)
评论(0)
推荐(0)
摘要:
{GetDriveType} //调用GetDriveTypeA(Memo1); procedureGetDriveTypeA(Memo:TMemo); var i:Integer; C:String; DType:Integer; DriveString:String; begin //通过循环依次判断各盘符的类型 Memo.Clear; fori:=65to90do begin C:=chr(i)+':\'; DType:=GetDriveType(PChar(C)); caseDTypeof 0:DriveString:=C+'不能判断的驱动器类型.'; 阅读全文
posted @ 2012-07-26 08:50
XE2011
阅读(731)
评论(0)
推荐(0)
摘要:
{获取本机当前用户名}//调用 返回值:= GetUser();function GetUserName(): string;varBuffer: array[0..255] of Char;Size: cardinal;beginSize := 256;if GetUserName(Buffer, Size) thenbeginResult := BufferendelsebeginResult := 'Unknown'end;end;{获取计算机名}//调用 返回值:= GetComputerName();function GetComputerName(): string 阅读全文
posted @ 2012-07-26 08:50
XE2011
阅读(329)
评论(0)
推荐(0)
摘要:
usesShellAPI;{打开网址}//调用Link('www.baidu.com'); procedureLink(URL:string); begin ShellExecute(Application.Handle,nil,PChar(URL),0,0,SW_SHOWNORMAL); end; 通过 为知笔记 发布 阅读全文
posted @ 2012-07-26 08:50
XE2011
阅读(244)
评论(0)
推荐(0)
摘要:
{取得汉字的第一个字母} //调用 edit1.text:=GetPYIndexChar('你')functionGetPYIndexChar(str:string):char; begin caseWORD(str[1])shl8+WORD(str[2])of $B0A1..$B0C4:result:='A'; $B0C5..$B2C0:result:='B'; $B2C1..$B4ED:result:='C'; $B4EE..$B6E9:result:='D'; $B6EA..$B7A1:result:= 阅读全文
posted @ 2012-07-26 08:50
XE2011
阅读(229)
评论(0)
推荐(0)
摘要:
//在uses下面引用function SHEmptyRecycleBinA(Wnd:HWND;str:PChar;WRD:DWORD):Integer;stdcall; external 'SHell32.dll';{清空回收站}//调用EmptyRecycle();functionEmptyRecycle():boolean; begin Result:=true; try ifApplication.MessageBox('确定要清空回收站吗?','提示',MB_YESNO)=ID_YESthen SHEmptyRecycleBinA(Ap 阅读全文
posted @ 2012-07-26 08:50
XE2011
阅读(264)
评论(0)
推荐(0)
摘要:
//============================================================================== {*******************************************************} {} {清空IE记录} {} {版权所有(C)2012testStudio} {} {最后修改2012年7月23日13:4... 阅读全文
posted @ 2012-07-26 08:49
XE2011
阅读(194)
评论(0)
推荐(0)
摘要:
{删除文件到回收站} //iffileexists('d:\a.txt')thenRecycleFile('d:\a.txt'+#0); //usesshellapi; functionRecycleFile(sFileName:string):Boolean; var FOS:TSHFileOpStruct; begin FillChar(FOS,SizeOf(FOS),0); withFOSd... 阅读全文
posted @ 2012-07-26 08:49
XE2011
阅读(295)
评论(0)
推荐(0)
摘要:
//------------------------------------------function Enc(Str:String):String;{加密} function Dec(Str:String):String;{解密} //------------------------------------------{字符加密} //调用Edit1.Text:=Enc(Edit1.Text);//加密 functionEnc(Str:String):String; constXorKey:array[0..7]ofByte=($B2,$09,$AA,$55,$93,$6D,$84,$47 阅读全文
posted @ 2012-07-26 08:49
XE2011
阅读(1407)
评论(0)
推荐(0)
摘要:
{得到文件的大小 KB}//调用返回值:=GetFileSize(application.ExeName);functionGetFileSize(constFileName:string):string; var SR:TSearchRec; begin Result:='-1'; ifFindFirst(FileName,faAnyFileand(notfaDirectory),SR)=0th... 阅读全文
posted @ 2012-07-26 08:49
XE2011
阅读(1279)
评论(0)
推荐(0)
摘要:
{让窗体全屏显示} //SetFormFullScreen(Form1); procedureSetFormFullScreen(Form:TForm); begin Form.BorderStyle:=bsNone; Form.WindowState:=wsMaximized; Form.Color:=clBlack; end; 通过 为知笔记 发布 阅读全文
posted @ 2012-07-26 08:49
XE2011
阅读(326)
评论(0)
推荐(0)
摘要:
{不重复添加Edit1.text到列表框中} //调用ListBoxAddItems(Edit1,ListBox1); procedureListBoxAddItems(Edit:TEdit;ListBox:TListBox); begin ifListBox.Items.IndexOf(Edit.Text)<0then begin ListBox.Items.Add(Edit.Text); Edit.SetFocus; end; end; 通过 为知笔记 发布 阅读全文
posted @ 2012-07-26 08:49
XE2011
阅读(278)
评论(0)
推荐(0)
摘要:
{对listbox中的整型数据重小到大排序并返回最小值} //调用sortListBox(ListBox1); //listbox的项目必须能转换成整型的数值functionsortListBox(ListBox:TListBox):integer; var I,J:Integer; temp:string; beginifListBox.Items.Count=0thenExit;withLis... 阅读全文
posted @ 2012-07-26 08:49
XE2011
阅读(221)
评论(0)
推荐(0)
摘要:
{使Edit控件中只能输入数字和1个小数点} //调用放在Edit的KeyPress事件下setOnePoint(Key,Edit1); procedureSetEditOnePoint(varKey:Char;CTRL:Tedit); varp:integer;tp:TPoint; begin ifkeyin['0'..'9','+','-','.']then begin ifkeyin['+'... 阅读全文
posted @ 2012-07-26 08:49
XE2011
阅读(307)
评论(0)
推荐(0)
摘要:
usesIniFiles;//引用IniFiles {$R*.dfm} {写入信息到ini文件} //WriteEdit('Config.ini','Options','Edit',Edit1); procedureWriteEdit(fileName:string;section:string;Ident:string;Edit:TEdit); varINIFILE:TIniFile; begi... 阅读全文
posted @ 2012-07-26 08:49
XE2011
阅读(226)
评论(0)
推荐(0)
摘要:
usesIniFiles; {写入列表框中的项目到ini中} //调用WriteListBoxItems('settings.ini','Listbox',ListBox1); procedureWriteListBoxItems(constAINIFile,ASection:string;ListBox:TListBox); var INI:TINIFile; iniPath:string;//... 阅读全文
posted @ 2012-07-26 08:49
XE2011
阅读(178)
评论(0)
推荐(0)
摘要:
usesRegistry; {ReadStrFormRegRegistry} //调用ReadStrFormReg('TEST',Edit1); procedureWriteStrToReg(SectionStr:string;Edit:TEdit); var Reg:TRegistry; keyName:string; begin Reg:=TRegistry.Create; Reg.RootK... 阅读全文
posted @ 2012-07-26 08:49
XE2011
阅读(128)
评论(0)
推荐(0)
摘要:
{shutdown -s -t 0 立即关闭计算机shutdown -l 立即注销计算机shutdown -r -t 0 立即重启计算机shutdown -a 取消关闭计算机}{在uses中引入 ShellAPI} uses ShellAPI;{关机相关}//调用//Shutdown(0);procedure Shutdown(sType:integer);begincasesType of0: ShellExecute(Application.Handle, 'open', 'shutdown.exe', '-s -t 0', 0, SW_SH 阅读全文
posted @ 2012-07-26 08:49
XE2011
阅读(279)
评论(0)
推荐(0)