05 2008 档案
WinAPI: OffsetWindowOrgEx - 移动窗口坐标原点
摘要:相关函数: OffsetViewportOrgEx 本例效果图: 代码文件: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls, ExtCtrls; type TF... 阅读全文
posted @ 2008-05-31 23:58 万一 阅读(3218) 评论(0) 推荐(0) 编辑
WinAPI: SetWindowOrgEx - 设置窗口坐标原点
摘要:相关函数: GetWindowOrgEx、SetViewportOrgEx(设置视口坐标原点)、SetViewportOrgEx 本例效果图: 代码文件: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, S... 阅读全文
posted @ 2008-05-31 23:40 万一 阅读(4034) 评论(0) 推荐(0) 编辑
WinAPI: OffsetClipRgn、PtVisible
摘要:OffsetClipRgn: 移动剪切区域; PtVisible: 判断点是否在剪切区域中. 本例效果图: 代码文件: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = cla... 阅读全文
posted @ 2008-05-30 01:23 万一 阅读(2434) 评论(5) 推荐(0) 编辑
WinAPI: SelectClipRgn、ExtSelectClipRgn、SelectClipPath - 定义剪切区域
摘要:剪切区域也是区域的一种, 窗口在重绘时只会重绘剪切区域中的内容. SelectClipRgn 和 ExtSelectClipRgn 是通过指定区域来定义剪切区域; SelectClipPath 是通过指定路径来定义剪切区域; ExtSelectClipRgn 和 SelectClipPath 比 SelectClipRgn 多出一个与原剪切区域混合方式的参数: RGN_AND = 1; RGN... 阅读全文
posted @ 2008-05-29 17:56 万一 阅读(7297) 评论(0) 推荐(0) 编辑
用 Memo 读取 UniCode 编码的文本文件 - 回复 "ahgan" 的问题
摘要:问题来源: http://www.cnblogs.com/del/archive/2008/05/29/1005631.html#1212654 首先, 这个问题到 Delphi 2008 时, 可能就不存在了, 因为那时的 TStrings 肯定支持 UniCode; 当前版本是 2007. unit Unit1; interface uses Windows, Messages, ... 阅读全文
posted @ 2008-05-29 13:18 万一 阅读(4806) 评论(12) 推荐(0) 编辑
获取窗口矩形的四种方法: GetClientRect、ClientRect、GetWindowRect、BoundsRect
摘要:其中 GetClientRect、ClientRect 获取的是窗口的客户区矩形; GetWindowRect、BoundsRect 是获取窗口矩形; 另外, 还有一个 Windows.GetClientRect(使用方法同 GetWindowRect, 它们都是 API 函数), 这里使用的 GetClientRect 是 Forms.GetClientRect. 本例效果图: unit... 阅读全文
posted @ 2008-05-29 12:31 万一 阅读(18742) 评论(0) 推荐(0) 编辑
多维动态数组与多维动态数组指针 - 回复 "lz_whj" 的问题
摘要:问题来源: http://www.cnblogs.com/del/archive/2008/05/28/1208964.html#1211428 本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, S... 阅读全文
posted @ 2008-05-28 11:48 万一 阅读(4744) 评论(20) 推荐(0) 编辑
WinAPI: InvertRgn - 区域颜色取反
摘要:本例效果图: 代码文件: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) CheckBox1: TC... 阅读全文
posted @ 2008-05-28 10:37 万一 阅读(3469) 评论(4) 推荐(0) 编辑
WinAPI: PathToRegion - 将路径转换为区域
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) procedure FormPaint(Sender: TObject); ... 阅读全文
posted @ 2008-05-28 09:49 万一 阅读(3742) 评论(0) 推荐(0) 编辑
绘制正弦曲线和余弦曲线
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) procedure FormPaint(Sender: TObject); ... 阅读全文
posted @ 2008-05-27 23:10 万一 阅读(7765) 评论(0) 推荐(0) 编辑
使用 System.Sin、System.Cos 函数画圆 - 绘制五环图标
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedur... 阅读全文
posted @ 2008-05-27 22:21 万一 阅读(7155) 评论(10) 推荐(0) 编辑
WinAPI: RectInRegion - 判断矩形是否位于区域中
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2:... 阅读全文
posted @ 2008-05-27 13:01 万一 阅读(3500) 评论(0) 推荐(0) 编辑
WinAPI: PtInRegion、OffsetRgn
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); ... 阅读全文
posted @ 2008-05-27 11:35 万一 阅读(3487) 评论(0) 推荐(0) 编辑
WinAPI: SetRectRgn - 将区域转换成矩形区域
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) procedure FormClick(Sender: TObject); ... 阅读全文
posted @ 2008-05-27 10:30 万一 阅读(2594) 评论(0) 推荐(0) 编辑
WinAPI: CombineRgn - 区域合成
摘要:CombineRgn( p1: HRGN; {合成后的区域} p2, p3: HRGN; {两个原始区域} p4: Integer {合并选项; 见下表} ): Integer; {有四种可能的返回值} //合并选项: RGN_AND = 1; RGN_OR = 2; RGN_XOR = 3; RGN_DIFF = 4; RGN_COPY = 5; {复... 阅读全文
posted @ 2008-05-26 23:17 万一 阅读(13121) 评论(7) 推荐(1) 编辑
WinAPI: CreatePolyPolygonRgn - 建立多个多边形构成的区域
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) procedure FormClick(Sender: TObject); ... 阅读全文
posted @ 2008-05-26 17:01 万一 阅读(8140) 评论(22) 推荐(0) 编辑
WinAPI: CreatePolygonRgn - 建立多边形区域
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) procedure FormPaint(Sender: TO... 阅读全文
posted @ 2008-05-26 16:22 万一 阅读(8871) 评论(1) 推荐(1) 编辑
WinAPI: CreateRoundRectRgn - 建立圆角矩形区域
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) procedure FormPaint(Sender: TObject); ... 阅读全文
posted @ 2008-05-26 15:25 万一 阅读(8143) 评论(0) 推荐(0) 编辑
WinAPI: CreateEllipticRgn、CreateEllipticRgnIndirect - 建立椭圆区域
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) procedure FormPaint(Sender: TObject); ... 阅读全文
posted @ 2008-05-26 15:20 万一 阅读(4716) 评论(0) 推荐(0) 编辑
WinAPI: CreateRectRgn、CreateRectRgnIndirect、FillRgn、FrameRgn - 建立矩形区域
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) procedure FormPaint(Sender: TObject); ... 阅读全文
posted @ 2008-05-26 15:14 万一 阅读(5422) 评论(4) 推荐(0) 编辑
WinAPI: FlattenPath、WidenPath
摘要:不管什么曲线命令, 到来路径中都会变成 Bezier 线; 也就是说路径中只有直线和 Bezier 线. FlattenPath 和 WidenPath 都能够把路径中的 Bezier 线转换为近似的直线; 不同的是: 用 WidenPath 转换后貌似加宽了线, 其实它是转换成了一个包围路径的新路径(类似区域). 本例效果图: 代码文件: unit Unit1; interface u... 阅读全文
posted @ 2008-05-26 13:46 万一 阅读(3045) 评论(0) 推荐(0) 编辑
WinAPI: GetPath - 获取路径中的点
摘要:本例效果图: 代码文件: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Memo1: TMemo;... 阅读全文
posted @ 2008-05-26 11:48 万一 阅读(3665) 评论(0) 推荐(0) 编辑
WinAPI: SetBkMode - 设置背景模式
摘要:本例效果图: 代码文件: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) RadioGroup1: ... 阅读全文
posted @ 2008-05-24 20:35 万一 阅读(7400) 评论(3) 推荐(0) 编辑
WinAPI: CloseFigure
摘要:本例效果图: 代码文件: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) CheckBox1: TC... 阅读全文
posted @ 2008-05-24 00:03 万一 阅读(1868) 评论(3) 推荐(0) 编辑
WinAPI: BeginPath、EndPath、StrokePath、FillPath、StrokeAndFillPath
摘要:BeginPath {路径开始} EndPath {路径结束} StrokePath {绘制路径} FillPath {填充路径} StrokeAndFillPath {绘制并填充路径} //在路径中可以使用的图形命令有: AngleArc Arc ArcTo Chord CloseFigure Ellipse ExtText... 阅读全文
posted @ 2008-05-23 22:39 万一 阅读(7173) 评论(3) 推荐(0) 编辑
WinAPI: EqualRect、EqualSid、EqualPrefixSid - 判断一个矩形(或其他结构)是否相等
摘要:unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton... 阅读全文
posted @ 2008-05-23 15:59 万一 阅读(2076) 评论(1) 推荐(0) 编辑
WinAPI: SetRectEmpty、IsRectEmpty
摘要:SetRectEmpty: 使矩形为空; IsRectEmpty: 判断矩形是否为空; 所谓矩形为空就是矩形是无区域的, 或者说是 Right unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type T... 阅读全文
posted @ 2008-05-23 13:16 万一 阅读(2602) 评论(0) 推荐(0) 编辑
WinAPI: SetRect 及初始化矩形的几种办法
摘要:本例分别用五种办法初始化了同样的一个矩形, 运行效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1:... 阅读全文
posted @ 2008-05-23 11:50 万一 阅读(6068) 评论(0) 推荐(0) 编辑
WinAPI: PtInRect - 判断点是否在矩形中
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedur... 阅读全文
posted @ 2008-05-23 00:13 万一 阅读(5348) 评论(2) 推荐(1) 编辑
WinAPI: InvertRect - 翻转矩形中像素的颜色
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2:... 阅读全文
posted @ 2008-05-22 23:55 万一 阅读(2469) 评论(0) 推荐(0) 编辑
WinAPI: OffsetRect - 移动矩形
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2:... 阅读全文
posted @ 2008-05-22 23:04 万一 阅读(3930) 评论(2) 推荐(0) 编辑
WinAPI: IntersectRect、SubtractRect、UnionRect - 用两个矩形合成一个新的矩形
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2:... 阅读全文
posted @ 2008-05-22 21:22 万一 阅读(5550) 评论(0) 推荐(0) 编辑
我是怎样给 Delphi 代码着色的 - 回复 "sunhj " 的问题
摘要:问题来源: http://www.cnblogs.com/del/archive/2008/05/22/1101470.html#1205901 着色是通过 js 动态实现的, 只用到两个文件: del.js 和 del.css; 类似这样使用即可: //此处嵌入 Delphi 代码 //此处嵌入 C/C++ 代码 因为是配合博客弄的, 博客也才有半年时间,... 阅读全文
posted @ 2008-05-22 14:43 万一 阅读(2899) 评论(2) 推荐(0) 编辑
把文字输出到屏幕
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2... 阅读全文
posted @ 2008-05-22 11:47 万一 阅读(6252) 评论(10) 推荐(0) 编辑
以前的 Delphi
摘要:Delphi 1 Delphi 2 Delphi 3 Delphi 4 Delphi 5 Delphi 6 Delphi 7 Delphi 8 Delphi 2005 阅读全文
posted @ 2008-05-21 23:47 万一 阅读(2304) 评论(3) 推荐(0) 编辑
关于动态数组、静态数组转换为字符串的一些问题 - 给 "厨师" 的回复
摘要:问题来源: http://www.cnblogs.com/del/archive/2008/05/21/1192113.html#1204252 首先, 只有字符类型的数组才可以直接转换为字符串! //这是静态数组的例子: var Arr: array[0..9] of Char; s: string; p: PChar; i: Integer; begin {给 Arr 赋... 阅读全文
posted @ 2008-05-21 18:15 万一 阅读(5116) 评论(9) 推荐(0) 编辑
论证 Assigned(btn) 与 Assigned(@btn) 的区别 - 答复 "sunnet"
摘要:问题来源: http://www.cnblogs.com/del/archive/2008/05/21/1101470.html#1204455 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;... 阅读全文
posted @ 2008-05-21 11:08 万一 阅读(2392) 评论(2) 推荐(0) 编辑
WinAPI: StrokePath - 描绘路径轮廓
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) procedure FormPaint(Sender: TObject); ... 阅读全文
posted @ 2008-05-20 18:27 万一 阅读(2771) 评论(0) 推荐(0) 编辑
WinAPI: GetRegionData
摘要:GetRegionData( RGN: HRGN; {区域句柄} p2: DWORD; {区域数据缓冲区大小} p3: PRgnData {区域数据结构 TRgnData 的指针, 见下表} ): DWORD; {成功返回 1} //TRgnData 是 _RGNDATA 结构的重命名: _RGNDATA = record rdh: TRgnDataHeade... 阅读全文
posted @ 2008-05-20 16:18 万一 阅读(4823) 评论(10) 推荐(0) 编辑
隐藏桌面图标和任务栏
摘要:unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) CheckBox1: TCheckBox; CheckBox2: T... 阅读全文
posted @ 2008-05-20 11:20 万一 阅读(5491) 评论(5) 推荐(0) 编辑
关于 # 符号的使用 - 给 "厨师" 的回复
摘要:问题来源: http://www.cnblogs.com/del/archive/2008/05/19/1089944.html#1203165 1、# 后面跟一个字符编码可以表示这个字符, 字符编码可以用十进制或十六进制表示; 譬如字符 "A" 的编码是 65(十进制) 或 $41(十六进制). ANSII 编码表参见: http://www.cnblogs.com/del/archive/20... 阅读全文
posted @ 2008-05-19 22:43 万一 阅读(3334) 评论(9) 推荐(0) 编辑
关于 PChar 串的结束 - 给 "厨师" 的回复
摘要:问题来源: http://www.cnblogs.com/del/archive/2008/05/19/1089437.html#1203173 PChar 串是以 Null 结束的, 或者说是以 "空字节" 结束的; PChar 串见到 "空字节" 就认作结束了; "空字节" 在 Delphi 中可以用 #0 或 Chr(0) 来表示. //举例: var pc: PChar; begi... 阅读全文
posted @ 2008-05-19 22:05 万一 阅读(1740) 评论(1) 推荐(0) 编辑
WinAPI: AlphaBlend - 图像透明度
摘要:AlphaBlend( DC: HDC; {目标设备环境句柄} p2, p3, p4, p5: Integer; {目标位置与宽高} DC6: HDC; {源设备环境句柄} p7, p8, p9, p10: Integer; {源位置与宽高} p11: TBlendFunction {合成方式的数... 阅读全文
posted @ 2008-05-19 17:33 万一 阅读(11025) 评论(1) 推荐(2) 编辑
沉痛哀悼我遇难的同胞们...
摘要: 阅读全文
posted @ 2008-05-19 11:07 万一 阅读(1695) 评论(0) 推荐(0) 编辑
捕捉全屏图像
摘要:unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button... 阅读全文
posted @ 2008-05-16 14:30 万一 阅读(5285) 评论(12) 推荐(0) 编辑
学习 TTreeView [16] - 给 TTreeView 添加复选框 (回复 "丁永其" 的问题)
摘要:问题来源: http://www.cnblogs.com/del/archive/2008/05/15/1114450.html#1199402 本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, C... 阅读全文
posted @ 2008-05-15 17:12 万一 阅读(8088) 评论(34) 推荐(0) 编辑
一个没有了解透的简单函数: BoolToStr
摘要:unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton... 阅读全文
posted @ 2008-05-15 12:27 万一 阅读(7751) 评论(2) 推荐(2) 编辑
把窗体客户区图像保存到文件或剪切板
摘要:unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton... 阅读全文
posted @ 2008-05-15 11:20 万一 阅读(6767) 评论(19) 推荐(0) 编辑
回复 "刘那" 的问题: 你的例子挺好玩的, 我模拟做了一下
摘要:问题来源: http://www.cnblogs.com/del/archive/2008/05/14/1089344.html#1196271 本例效果图: 代码文件: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dia... 阅读全文
posted @ 2008-05-14 15:00 万一 阅读(2614) 评论(3) 推荐(0) 编辑
内存管理[6]
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2:... 阅读全文
posted @ 2008-05-13 16:57 万一 阅读(6509) 评论(15) 推荐(1) 编辑
SysUtils.StrByteType - 获取字节类型
摘要:unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Memo1: TMemo; procedure FormCreate... 阅读全文
posted @ 2008-05-13 14:07 万一 阅读(2607) 评论(1) 推荐(0) 编辑
SysUtils.StrAlloc、SysUtils.StrBufSize
摘要:StrAlloc : 给 PChar 指针分配空间, 并填充 #0; StrBufSize : PChar 缓冲区大小. unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 =... 阅读全文
posted @ 2008-05-13 13:43 万一 阅读(2802) 评论(0) 推荐(0) 编辑
SysUtils 中其他 PChar 函数: StrPas、StrNew、StrDispose、StrNextChar、StrFmt、StrLFmt、StrCharLength
摘要://StrPas: 转换 PChar 为 string; 现在可以直接赋值, 很少用了. var p: PChar; s: string; begin p := 'Delphi'; s := StrPas(p); ShowMessage(s); {Delphi} end; //StrNew、StrDispose: 建立与销毁 PChar. var p: PChar; ... 阅读全文
posted @ 2008-05-13 13:13 万一 阅读(8496) 评论(0) 推荐(0) 编辑
SysUtils.StrMove
摘要:其实这也是个 Copy 函数, 和 Move 没有关系. unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) procedure FormCreat... 阅读全文
posted @ 2008-05-13 09:59 万一 阅读(2445) 评论(0) 推荐(0) 编辑
SysUtils.StrEnd、SysUtils.StrLen
摘要:StrEnd 获取 PChar 串未指针; StrLen 获取 PChar 串长度. unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm)... 阅读全文
posted @ 2008-05-12 23:05 万一 阅读(2286) 评论(0) 推荐(0) 编辑
SysUtils.StrScan、SysUtils.StrRScan、SysUtils.StrPos
摘要:StrScan : 返回一个字符在一个 PChar 串中第一次出现的位置指针; StrRScan : 返回一个字符在一个 PChar 串中最后一次出现的位置指针; StrPos : 返回一个 PChar 串在另一个 PChar 串中第一次出现的位置指针. unit Unit1; interface uses Windows, Messages, SysUtils, Varia... 阅读全文
posted @ 2008-05-12 22:52 万一 阅读(3351) 评论(1) 推荐(0) 编辑
SysUtils.StrLCat
摘要:StrLCat 与 StrCat 类似, StrLCat 多出的参数好像是限制结果的长度. unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TFo... 阅读全文
posted @ 2008-05-12 22:40 万一 阅读(1869) 评论(1) 推荐(0) 编辑
SysUtils.StrUpper、SysUtils.StrLower
摘要:StrUpper 和 StrLower 是转换 PChar 串的大小写的函数. unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) ... 阅读全文
posted @ 2008-05-12 21:44 万一 阅读(2050) 评论(0) 推荐(0) 编辑
SysUtils.StrLCopy、SysUtils.StrPCopy、SysUtils.StrPLCopy
摘要:StrLCopy 只是比 StrCopy 多了一个限制长度的参数; StrPCopy 等价于 StrCopy; StrPLCopy 等价于 StrLCopy. unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; t... 阅读全文
posted @ 2008-05-12 21:23 万一 阅读(5301) 评论(0) 推荐(1) 编辑
SysUtils.StrCopy、SysUtils.StrECopy
摘要:StrCopy 和 StrECopy 都是复制源 PChar 串到目标 PChar 串, 只是返回值不同; StrCopy 返回结果的首地址, StrECopy 返回结果的尾(#0)地址. unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Form... 阅读全文
posted @ 2008-05-12 21:21 万一 阅读(5205) 评论(1) 推荐(0) 编辑
SysUtils.StrLComp、SysUtils.StrLIComp
摘要:StrLComp、StrLIComp 与 StrComp、StrIComp 基本是一样的, 只是多了一个参数用来指定有效长度. unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = c... 阅读全文
posted @ 2008-05-12 16:52 万一 阅读(2451) 评论(0) 推荐(0) 编辑
SysUtils.StrComp、SysUtils.StrIComp
摘要:StrComp 和 StrIComp 都是对比 PChar 字串的大小的函数, 只是后者不区分大小写. unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = cla... 阅读全文
posted @ 2008-05-12 14:31 万一 阅读(3031) 评论(0) 推荐(0) 编辑
SysUtils.StrCat
摘要://把源串添加到目标串后, 要求目标串必须有足够的空间 StrCat( Dest: PChar; {目标串} const Source: PChar {源串} ): PChar; {返回目标串} unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Clas... 阅读全文
posted @ 2008-05-12 14:11 万一 阅读(3076) 评论(5) 推荐(0) 编辑
获取集合元素个数 - 回复"鹰@长空"
摘要:问题来源: http://www.cnblogs.com/del/archive/2008/05/11/978683.html#1191835 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TF... 阅读全文
posted @ 2008-05-11 13:09 万一 阅读(5048) 评论(10) 推荐(0) 编辑
如何把字符串覆给数组 - 回复"刘那"
摘要:问题来源: http://www.cnblogs.com/del/archive/2008/05/11/1089344.html#1191871 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;... 阅读全文
posted @ 2008-05-11 12:31 万一 阅读(6149) 评论(14) 推荐(0) 编辑
获取变量类型的函数
摘要:Variants 单元下的 VarType 函数可以获取变量类型, 但它返回的只是一个数字; 需要再结合一下在 System 单元里定义的这些常量: varEmpty = $0000; varNull = $0001; varSmallint = $0002; varInteger = $0003; varSingle = $0004; varDouble = $0005... 阅读全文
posted @ 2008-05-09 23:01 万一 阅读(5556) 评论(4) 推荐(0) 编辑
内存管理[5]
摘要:本例在建立一个新的堆前后分别通过 GetProcessHeaps 函数获取了当前进程的堆句柄列表, 没想到一个最简单的程序也有 5 个堆. 效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtr... 阅读全文
posted @ 2008-05-09 19:12 万一 阅读(5715) 评论(15) 推荐(2) 编辑
内存管理[4]
摘要:一个使用私有堆的例子: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; proc... 阅读全文
posted @ 2008-05-09 15:22 万一 阅读(6542) 评论(19) 推荐(1) 编辑
内存管理[3]
摘要:VirtualAlloc 分配的内存是以 4K 为最小单位、连续的内存地址(但映射到真实的内存时它不一定是连续的), 前面说了, 它不适合分配小内存(譬如只有几个字节的变量); 局部的变量在 "栈" 中有程序自动管理, 那么那些全局的小变量怎么办呢? 这就要用到 "堆". 这样看来, VirtualAlloc 分配的内存既不是 "栈" 也不是 "堆"; VirtualAlloc 分配的内存地址是... 阅读全文
posted @ 2008-05-08 17:22 万一 阅读(7710) 评论(7) 推荐(1) 编辑
内存管理[2]
摘要:系统给程序的地址数是 4G, 为什么不是 3G 或 5G? 因为 32 位的指针的最大值就是 $FFFFFFFF, 它不能表示更多了, 究其根源这要回到 CPU 的寻址能力、地址总线等等.在 Win64 下, 系统给程序的地址数达到了 16EB(0 - $FFFFFFFFFFFFFFFF), 也就是 18446744073709551616 个. 不过 Win64 还没有普及, 我们还得回到实际的... 阅读全文
posted @ 2008-05-06 15:11 万一 阅读(8629) 评论(12) 推荐(0) 编辑
内存管理[1]
摘要:Windows 是多任务的操作系统, 一个任务就是一个应用(应用程序)、一个应用占一个进程; 在一个进程里面, 又可以运行多个线程(所以就有了很多"多线程编程"的话题).对 Win32 来讲, 系统给每个进程 4GB 的地址空间:低端 2GB($00000000 - $7FFFFFFF) 给用户支配;高端 2GB($80000000 - $FFFFFFFF) 留给系统使用.文件或程序要调入内存才能... 阅读全文
posted @ 2008-05-06 12:00 万一 阅读(12943) 评论(14) 推荐(2) 编辑
开始学习内存管理
摘要:这是可能需要的函数: System.AllocMem; System.AllocMemCount; System.AllocMemSize; System.Dispose; System.Finalize; System.FreeMem; System.FreeMemory; System.GetHeapStatus; System.GetMem; System.GetMemory; Syste... 阅读全文
posted @ 2008-05-04 13:06 万一 阅读(10704) 评论(0) 推荐(0) 编辑
关于 GetMem 和 GetMemory 的区别 - 回复"下雨天2"
摘要:问题来源: http://www.cnblogs.com/del/archive/2008/05/02/1179416.html#1179645 我觉得 GetMem 和 GetMemory 的功能是一样的, 有点类似与 Format 和 FmtStr 的关系; 它们的区别只在于参数位置和返回值的区别, 看看 GetMemory 函数的源码就知道, 它其实就是调用的 GetMem. unit U... 阅读全文
posted @ 2008-05-02 19:57 万一 阅读(3725) 评论(1) 推荐(0) 编辑
关于指针初始化的问题 - 回复"下雨天2"
摘要:问题来源: http://www.cnblogs.com/del/archive/2008/05/02/1179416.html#1179645 一个全局变量可以初始化, 如果你不主动初始化, 也会被自动初始化; 一个局部变量不能被初始化, 虽然你不能主动初始化, 但它会被赋予一个随机值. unit Unit1; interface uses Windows, Messages, Sys... 阅读全文
posted @ 2008-05-02 19:44 万一 阅读(2098) 评论(1) 推荐(0) 编辑
WinAPI: GetKeyNameText - 根据键盘消息获取按键名称
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); ... 阅读全文
posted @ 2008-05-02 17:51 万一 阅读(8731) 评论(18) 推荐(0) 编辑
调整 TEdit 文本对齐
摘要:譬如让 Edit1 文本右对齐: SetWindowLong(Edit1.Handle, GWL_STYLE, GetWindowLong(Edit1.Handle, GWL_STYLE) or ES_RIGHT); 本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Gr... 阅读全文
posted @ 2008-05-02 12:59 万一 阅读(3916) 评论(23) 推荐(0) 编辑
获取窗口边框的宽度和标题栏的高度
摘要:方法一(通过 Width、ClientWidth 推算): var frame,caption: Integer; begin frame := (Width - ClientWidth) div 2; caption := Height - ClientHeight - frame * 2; ShowMessageFmt('边框宽: %d; 标题高: %d', [frame,c... 阅读全文
posted @ 2008-05-01 22:15 万一 阅读(12015) 评论(1) 推荐(0) 编辑
演示 Rect、Bounds 生成 TRect 的区别
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Button1: TButton; ... 阅读全文
posted @ 2008-05-01 18:07 万一 阅读(5476) 评论(4) 推荐(1) 编辑
创建异形窗口[6]
摘要:本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls; type TForm1 = class(TForm) Panel1: TPanel; procedure ... 阅读全文
posted @ 2008-05-01 11:24 万一 阅读(2986) 评论(0) 推荐(0) 编辑