随笔 - 2146  文章 - 19 评论 - 11846 阅读 - 1267万

随笔分类 -  点点滴滴-日积月累

上一页 1 2
一句话获取文件的最新修改时间
摘要:var DateTime: TDateTime;begin FileAge('C:\Windows\Notepad.exe', DateTime); ShowMessage(DateTimeToStr(DateTime));end; 阅读全文
posted @ 2010-01-18 13:45 万一 阅读(3452) 评论(1) 推荐(0) 编辑
一句话复制整个文件夹(当然包括嵌套文件夹) - 回复 "张哆哆" 的问题
摘要:问题来源: http://www.cnblogs.com/del/archive/2009/10/16/1584660.html#1742606使用的是 Delphi 2010 下 IOUtils 单元的 TDirectory.Copy 函数:uses IOUtils;procedure TForm1.Button1Click(Sender: TObject);const SourceDir =... 阅读全文
posted @ 2010-01-08 12:24 万一 阅读(10475) 评论(18) 推荐(0) 编辑
创建大窗口
摘要:procedure TForm1.FormCreate(Sender: TObject);begin SetWindowLong( Handle, GWL_STYLE, not (WS_THICKFRAME) and GetWindowLong(Handle, GWL_STYLE) or Integer(WS_POPUP) ); SetWindowPos(Handle, 0, 0, 0, 1... 阅读全文
posted @ 2009-12-27 14:54 万一 阅读(2266) 评论(0) 推荐(0) 编辑
X 的 Y 次方
摘要:var x,y,z: Real;begin x := 2; y := 3; { 使用 Math.Power } z := Math.Power(x, y); ShowMessage(FloatToStr(z)); //8 { 不想 uses Math, 就用 System.Exp、System.Ln } z := Exp(Ln(x) * y); ShowMessage(Float... 阅读全文
posted @ 2009-12-19 09:54 万一 阅读(5225) 评论(1) 推荐(0) 编辑
DebugHook 与 ReportMemoryLeaksOnShutdown
摘要:DebugHook 与 ReportMemoryLeaksOnShutdown 都是 System 下的变量.DebugHook: 程序中母体中运行时, 此值是 1; 独立运行时, 它是 0.在程序的任何地方加上一句 ReportMemoryLeaksOnShutdown := True; 这样程序在关闭时可检测是否有内存泄漏.如果这样使用: ReportMemoryLeaksOnShutdown... 阅读全文
posted @ 2009-12-16 15:46 万一 阅读(5807) 评论(0) 推荐(0) 编辑
可爱的 CreateMessageDialog
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3: TButton... 阅读全文
posted @ 2009-12-15 18:58 万一 阅读(3806) 评论(12) 推荐(0) 编辑
ExtCtrls.Frame3D
摘要:uses ExtCtrls;procedure TForm1.FormPaint(Sender: TObject);var R1, R2: TRect;begin R1 := Rect(10, 10, 150, 50); Frame3D(Canvas, R1, clBlack, clSilver, 1); R2 := Bounds(10, 80, 140, 40); Frame3D(Ca... 阅读全文
posted @ 2009-12-15 10:08 万一 阅读(2297) 评论(1) 推荐(0) 编辑
System.Assert 断言
摘要:可用 {$ASSERTIONS OFF/ON} 决定是否启用 Assert; 默认只用于 Debug 版本. 阅读全文
posted @ 2009-12-10 11:55 万一 阅读(4961) 评论(6) 推荐(0) 编辑
打开"我的电脑"等特殊文件夹
摘要:uses ShellAPI;//打开 C 盘procedure TForm1.Button1Click(Sender: TObject);begin ShellExecute(Handle, 'open', 'Explorer.exe', 'C:\', nil, SW_SHOWNORMAL);end;//打开 我的电脑procedure TForm1.Button2Click(Sender: T... 阅读全文
posted @ 2009-12-09 13:19 万一 阅读(3447) 评论(7) 推荐(1) 编辑
SameText
摘要:var s1,s2: string; b1,b2: Boolean;begin s1 := 'C:\Temp'; s2 := 'c:\temp'; b1 := SameText(s1, s2); //True b2 := s1 = s2; //False ShowMessage(BoolToStr(b1,True) + ' - ' + BoolToStr(b2,True));end; 阅读全文
posted @ 2009-12-07 15:39 万一 阅读(5422) 评论(3) 推荐(0) 编辑
如何在定义局部变量时赋初始值
摘要:局部变量不像全局变量可赋初始值, 但可以通过编译指令把指定类型的常量当作变量用, 如:const{$J+} num: Integer = 1;{$J-}begin Inc(num); ShowMessage(IntToStr(num)); {2}end;//或者写作:const{$WRITEABLECONST ON} num: Integer = 1;{$WRITEABLECONST OF... 阅读全文
posted @ 2009-11-09 18:12 万一 阅读(9470) 评论(3) 推荐(0) 编辑

上一页 1 2


点击右上角即可分享
微信分享提示