大悟还俗

邮箱 key_ok@qq.com 我的收集 http://pan.baidu.com/share/home?uk=1177427271
  新随笔  :: 联系 :: 订阅 订阅  :: 管理

2013年10月29日

摘要: 1. 首先需要设置程序生成 map 文件。Project -> Options -> Linker -> Map file , Detailed2. 计算公式Edit2.Text := IntToHex(StrToInt('$'+ Edit1.Text) - StrToInt('$00400000') - StrToInt('$00001000'), 8) ;将看到的地址错误,输入到 Edit1 中。3. 从 Map 文件中查这个地址。一般直接查是找不到的。根据获得的 Edit2 中的值。删掉最后 1 位,或者 2 位,查。得到 阅读全文

posted @ 2013-10-29 14:58 大悟还俗_2 阅读(1325) 评论(0) 推荐(0) 编辑

摘要: uses Winapi.GDIPAPI, Winapi.GDIPOBJ{, Winapi.GDIPUTIL};procedure TForm1.FormPaint(Sender: TObject);var graphics: TGPGraphics; pen: TGPPen;begin graphics := TGPGraphics.Create(Canvas.Handle); pen := TGPPen.Create(MakeColor(255,0,0)); graphics.DrawRectangle(pen, MakeRect(11, 22, 33, 44)); pen.Fr... 阅读全文

posted @ 2013-10-29 13:58 大悟还俗_2 阅读(212) 评论(0) 推荐(0) 编辑

2013年10月28日

摘要: ******************************* * 编 译 错 误 信 息 * *******************************';' not allowed before 'ELSE' ElSE前不允许有“;”'' clause not allowed in OLE automation section 在OLE自动区段不允许“”子句'' is not a ty... 阅读全文

posted @ 2013-10-28 17:52 大悟还俗_2 阅读(827) 评论(0) 推荐(0) 编辑

2013年10月25日

摘要: Delphi ListView基本用法大全//增加项或列(字段)ListView1.Clear;ListView1.Columns.Clear;ListView1.Columns.Add;ListView1.Columns.Add;ListView1.Columns.Add;ListView1.Columns.Items[0].Caption:='id';ListView1.Columns.Items[1].Caption:='type';ListView1.Columns.Items[2].Caption:='title';ListView1. 阅读全文

posted @ 2013-10-25 01:03 大悟还俗_2 阅读(426) 评论(0) 推荐(0) 编辑

2013年10月21日

摘要: 以下代码旨在 脱离TXMLDocument 操作 xml。unit Unit3;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, xmldom, XMLIntf, msxmldom, XMLDoc, StdCtrls;type TForm3 = class(TForm) XMLDocument1: TXMLDocument; Button1: TButton; Button2: TButton; Button3: TBu... 阅读全文

posted @ 2013-10-21 16:56 大悟还俗_2 阅读(844) 评论(0) 推荐(0) 编辑

摘要: unit ExEdit; interface uses System.Classes, Vcl.Controls, Winapi.Windows, Vcl.Graphics, Vcl.StdCtrls, System.SysUtils, Winapi.messages; type TBorders = class(TPersistent) private FRight: Boolean; FBottom: Boolean; FTop: Boolean; FLeft: Boolean; FPen: TPen; public constructor ... 阅读全文

posted @ 2013-10-21 16:51 大悟还俗_2 阅读(299) 评论(0) 推荐(0) 编辑

摘要: 先看看实现的效果如: 首先,我们来分析一下,这个控件的继承方式,这个根据个人需要,如果仅仅作为显示使用,不涉及到太多的消息以及事件响应消息的可以从TGraphicControl继承来实现,因为TGraphicControl就是专门用来实现仅仅显示效果的控件的,他的特性,我在前面的概述中有提到过,不明白的可以返回去查看;如果需要处理一些特殊消息以及句柄的处理的,那么请从TWinControl继承来实现。这里我选择直接从TGraphicControl来实现! 其次,这个动画效果,我们通过什么来实现!这个很容易想到TImagelist,Delphi自己带有的一组图片集合控件,通过这个图片集合,我们可 阅读全文

posted @ 2013-10-21 16:43 大悟还俗_2 阅读(283) 评论(0) 推荐(0) 编辑

摘要: 第一步,平面效果。Windows系统有几个消息专门用来处理Windows组件的边框部位,那就是WM_NCCALCSIZE和WM_NCPAINT这两个消息,从消息名字看来NC这个就代表着No Client也就是非客户区域,NCCALCSIZE也就是说明了计算非客户区和客户区的消息,而WM_NCPAINT消息,也就是非客户区域的绘制触发消息,所以就要截获这两个消息来绘制自己的边框取代Windows系统的绘制方式。在Delphi中拦截系统消息非常简单,直接在消息的处理过程后面跟一个message关键字,然后加上消息常量就可以了!不像MFC要搞消息映射那么麻烦,声明代码如下procedure WMNc 阅读全文

posted @ 2013-10-21 16:41 大悟还俗_2 阅读(521) 评论(0) 推荐(0) 编辑

摘要: 一.原理通过使用“内存映射文件”,实现内存共享二.主要操作共享内存结构: PShareMem = ^TShareMem; TShareMem = Record id:string[10]; name:string[20]; age:Integer; end; 基本变量: shareMemName:string; //共享内存名 fileHandle : THandle;//内存映射文件句柄 pUserInfoShareMem : PShareMem;//指向共享内存的指针 a)写入程序 1)创建“内存映射文件”begin //创建“内存映射文件”... 阅读全文

posted @ 2013-10-21 16:39 大悟还俗_2 阅读(404) 评论(0) 推荐(0) 编辑

摘要: unit filemap;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;const fileName = 'myTest.txt';type TForm1 = class(TForm) btnUpper: TButton; btnLower: TButton; txtContent: TMemo; Label1: TLabel; btnClose: TButton; procedu... 阅读全文

posted @ 2013-10-21 16:38 大悟还俗_2 阅读(1659) 评论(0) 推荐(0) 编辑

摘要: 一.原理 通过使用“内存映射文件”,实现内存共享 二.主要操作 共享内存结构: PShareMem = ^TShareMem; TShareMem = Record id:string[10]; name:string[20]; age:Integer; end;// 一定要注意 固定长度 基本变量 阅读全文

posted @ 2013-10-21 16:33 大悟还俗_2 阅读(2103) 评论(0) 推荐(0) 编辑

摘要: unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Edit1: TEdit; procedure FormCreate(Sender: TObject); private { Private ... 阅读全文

posted @ 2013-10-21 14:34 大悟还俗_2 阅读(394) 评论(0) 推荐(0) 编辑

摘要: {== D6DLLSynchronizer =================================================}{: This unit handles the D6 synchronize problem in DLLs@author Dr. Peter Below@desc Version 1.0 created 3 November 2001 Current revision 1.0 Last modified 3 November 2001Usage: Just add this unit to the DLL... 阅读全文

posted @ 2013-10-21 14:32 大悟还俗_2 阅读(578) 评论(0) 推荐(0) 编辑

摘要: unit Unit1;interfaceuses ImageHlp,Windows,Dialogs; procedure ListDLLExports(const AFileName:string);implementationprocedure ListDLLExports(const AFileName:string);type TDWordArray = array [0..$FFFFF] of DWORD;var image:TLoadedImage; pExpDir:PImageExportDirectory; iSize:Cardinal; pNameRVAs:^TDW... 阅读全文

posted @ 2013-10-21 14:30 大悟还俗_2 阅读(214) 评论(0) 推荐(0) 编辑

摘要: // ① Delphi 使用 Interlocked 系列函数var MyValue:Longint = 0; // = Integerbegin InterlockedIncrement(MyValue); // + 1 返回值通常不用 InterlockedDecrement(MyValue); // - 1 返回值通常不用 InterlockedExchangeAdd(MyValue,10); // + 10 InterlockedExchangeAdd(PLongint(@MyValue),-10); // - 10 函数 overload InterlockedExcha... 阅读全文

posted @ 2013-10-21 14:27 大悟还俗_2 阅读(387) 评论(0) 推荐(0) 编辑

摘要: unit Unit2;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ImgList, ExtCtrls;type TForm2 = class(TForm) ImageList1: TImageList; Panel1: TPanel; procedure FormCreate(Sender: TObject); private { Private declarations } public { Publi... 阅读全文

posted @ 2013-10-21 14:26 大悟还俗_2 阅读(330) 评论(0) 推荐(0) 编辑

摘要: procedure TForm1.Button1Click(Sender: TObject);var i1,i2:Integer; b:array [0..3] of Byte absolute i1; // b 在这里跟 i1 共用地址begin i1 := 1234; i2 := MakeLong(MakeWord(b[0],b[1]),MakeWord(b[2],b[3])); // 在内存中i1其实是反过来存储, // 普通情况表达一个数字是“高位+低位”,而内存中是“低位+高位”的表达方式 // MakeXXX 函数就是实现了这种变化 if i1 = i2 then ... 阅读全文

posted @ 2013-10-21 14:25 大悟还俗_2 阅读(353) 评论(0) 推荐(0) 编辑

摘要: 以下代码可以看到 Int64Rec Int64procedure TForm1.Button2Click(Sender: TObject);var ii1,ii2,ii3:Int64;Hi,Lo:Cardinal;temp:Int64Rec;begin ii1 := 123456; Hi := Int64Rec(ii1).Hi; Lo := Int64Rec(ii1).Lo; ii2 := MakeROP4(Lo,Hi); // 这个函数没有什么实质的意义,只是为了表达 Hi + Lo = Int64 if ii1 = ii2 then ShowMessage('确认'); . 阅读全文

posted @ 2013-10-21 14:23 大悟还俗_2 阅读(464) 评论(0) 推荐(0) 编辑

摘要: PerformEraseBackground 擦除背景的简单方法(外带ThemeServices例子) 在查这个函数的时候,顺便看到了有趣的代码。怎么使用 Themes 。unit Unit2;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ImgList, ExtCtrls;type TForm2 = class(TForm) ImageList1: TImageList; Panel1: TPanel; procedur... 阅读全文

posted @ 2013-10-21 14:03 大悟还俗_2 阅读(490) 评论(0) 推荐(0) 编辑

摘要: 我一直感觉 Delphi 下的Bit操作不是很好使,所以一直屏蔽着这方面的学习。不过最近收集整理了一下代码。原因是这样的。由于某个需求被分解成 在 0~n(不定) 中,有几个数字被置换成了“true”由于我自己写了一个类来管理某个Record,而这个Record是用Variant来作为参数。(类似TDataSet)。开始的时候,我想着吧,用 array of Boolean,可惜Variant 中怎么v:=VarCreateVariant([0,n],varBoolean)不会操作 v[10]:=true 这种事情。于是干脆变成了 array of Byte声明了8个array of Byte 阅读全文

posted @ 2013-10-21 14:00 大悟还俗_2 阅读(581) 评论(0) 推荐(0) 编辑

摘要: Longint = IntegerWPARAM = IntegerLPARAM = IntegerLRESULT = IntegerFARPROC = Pointerfunction MakeWord(a, b: Byte): Word;function MakeLong(a, b: Word): Longint;function MakeWParam(l, h: Word): WPARAM;function MakeLParam(l, h: Word): LPARAM;function MakeLResult(l, h: Word): LRESULT;function PointToLP.. 阅读全文

posted @ 2013-10-21 13:53 大悟还俗_2 阅读(389) 评论(0) 推荐(0) 编辑

摘要: 作为指针是相同的,解析的内容,稍微有点区别。var s:String;P:PChar;B:PByte;a:Integer;begins:='1234';P:=PChar(s);//按chr保存for a:=0 to 7 dobeginMemo1.Lines.add(P^);Inc(P);end;B:=PByte(s);//按Byte保存for a:=0 to 7 dobeginMemo1.Lines.add(IntToStr(B^)+','+Chr(B^));Inc(B);end;end; 阅读全文

posted @ 2013-10-21 13:52 大悟还俗_2 阅读(437) 评论(0) 推荐(0) 编辑

摘要: 执行控制台程序并且获得它的输出结果 procedure CheckResult(b: Boolean); begin if not b then Raise Exception.Create(SysErrorMessage(GetLastError)); end; function RunDOS(const Prog, CommandLine,Dir: String;var ExitCode:DWORD): String; var HRead,HWrite:THandl... 阅读全文

posted @ 2013-10-21 13:50 大悟还俗_2 阅读(302) 评论(0) 推荐(0) 编辑

摘要: function PauseConsole(Prompt: PAnsiChar): boolean;varhStdIn, hStdOut: THandle;dwRd, dwWr, i: Cardinal;cBuf: array [0..128] of TInputRecord;beginresult := false;hStdIn := GetStdHandle(STD_INPUT_HANDLE);hStdOut := GetStdHandle(STD_OUTPUT_HANDLE);if ((hStdIn 0) and (hStdOut 0)) thenbeginWriteFile(hSt.. 阅读全文

posted @ 2013-10-21 13:36 大悟还俗_2 阅读(687) 评论(0) 推荐(0) 编辑

摘要: ByteType('123你好吗',1)=mbSingleByte//单字节ByteType('123你好吗',4)=mbLeadByte//双字节字符的第一个字符ByteType('123你好吗',5)=mbTrailByte//双字节字符的第二个字符function IsMBCSChar(const ch: Char): Boolean;beginResult := (ByteType(ch, 1) mbSingleByte);end;是否中文(简体,繁体) 阅读全文

posted @ 2013-10-21 13:33 大悟还俗_2 阅读(422) 评论(0) 推荐(0) 编辑

摘要: unit Unit1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls,Clipbrd;typeTForm1 = class(TForm)Button1: TButton;Button2: TButton;procedure Button1Click(Sender: TObject);procedure Button2Click(Sender: TObject);private{ Private declarations }public 阅读全文

posted @ 2013-10-21 13:32 大悟还俗_2 阅读(369) 评论(0) 推荐(0) 编辑

摘要: How to install an INF file using DelphiIf you need to install an "inf" file using Delphi, you could use the next code:~~~~~~~~~~~~~~~~~~~~~~~~~{Usage:InstallINF('C:\XYZ.inf', 0) ;}usesShellAPI;function InstallINF(const PathName: string; hParent: HWND): Boolean;varinstance: HINST;be 阅读全文

posted @ 2013-10-21 13:32 大悟还俗_2 阅读(185) 评论(0) 推荐(0) 编辑

摘要: aa.CopyFromDataSet(acdsBase);//克隆一个,与LoadFromDataSet区别,如果设置了Field,那么L只会导入设置的部分,而C则是全部复制过来TdxMemData不能使用Filter。ID:=aa.FieldByName('ID').AsString;aa.Filter:='ParentID='+QuotedStr(ID);if aa.FindFirst thenrepeatPrompt(aa.FieldByName('Name').AsString);until aa.FindNext=false;无效。或许 阅读全文

posted @ 2013-10-21 13:29 大悟还俗_2 阅读(892) 评论(0) 推荐(0) 编辑

摘要: VarIsOrdinalVarIsFloatVarIsNumeric就三个。第一个 是否int,boolean第二个 是否Double,Simple,Currency第三个 是否Ordinal和Float。就是这样。 阅读全文

posted @ 2013-10-21 13:29 大悟还俗_2 阅读(562) 评论(0) 推荐(0) 编辑

摘要: uses CommCtrl; -- 很有料!!!procedure TForm1.Button1Click(Sender: TObject);var ebt: TEditBalloonTip;beginwith ebt dobegincbStruct := SizeOf(ebt);pszTitle := 'title';pszText := 'Text';ttiIcon := 1;end;SendMessage(Edit1.Handle,EM_SHOWBALLOONTIP,0,Longint(@ebt))end;// Balloon【Controls】var s 阅读全文

posted @ 2013-10-21 13:25 大悟还俗_2 阅读(362) 评论(0) 推荐(0) 编辑

摘要: type intArr=array of Integer;procedure TfrmMainDA.Button2Click(Sender: TObject);var aa:intArr;bb:intArr;vv:Variant;a:Integer;s:String;beginSetLength(aa,3);aa[0]:=1;aa[1]:=10;aa[2]:=100;DynArrayToVariant(vv,aa,TypeInfo(intArr));DynArrayFromVariant(Pointer(bb),vv,TypeInfo(intArr));for a:=Low(bb) to Hi 阅读全文

posted @ 2013-10-21 13:24 大悟还俗_2 阅读(492) 评论(0) 推荐(0) 编辑

摘要: //TARec--->Variantfunction RecordToVariant(value:TParamRecord):OleVariant;var P:Pointer;beginResult:=VarArrayCreate([0,sizeof(TParamRecord)],varByte);P:=VarArrayLock(Result);Move(value,P^,sizeof(P));VarArrayUnlock(Result);end;//OleVariant---->TARecfunction VariantToRecord(value:OleVariant):TPa 阅读全文

posted @ 2013-10-21 13:22 大悟还俗_2 阅读(284) 评论(0) 推荐(0) 编辑

摘要: 用 TStrings的Object 保存类的方式,来保存除了Items以外的值。今天才发现,原来,TStrings下,还有 Items,Values,Items.Names,Items.Values,Items.Strings之分。大家赶快去试试吧。如果只是简单的String类型的,用这些,足够的了。大家不用试了。我自己都快忘记,写了段。procedure TfrmRegManage.Button1Click(Sender: TObject);var sl:TStringList;a:Integer;beginsl:=TStringList.Create;for a:=0 to 10 dosl 阅读全文

posted @ 2013-10-21 13:19 大悟还俗_2 阅读(486) 评论(0) 推荐(0) 编辑

摘要: 利用GetClass与RegisterClass可以实现根据字符串来实例化具体的子类,这对于某些需要动态配置程序的场合是很有用的。其他的应用如子窗体切换,算法替换等都能得到应用。unitExample1;interfaceusesWindows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,Dialogs,StdCtrls;typeTForm1=class(TForm)Button1:TButton;procedureButton1Click(Sender:TObject);privatepublicend;ILog=in 阅读全文

posted @ 2013-10-21 13:18 大悟还俗_2 阅读(283) 评论(0) 推荐(0) 编辑

摘要: 很好理解type TMessageHandler = class //使得回车消息转换成Tab消息 class procedure AppMessage(var Msg:TMsg;var Handled:Boolean);end;var Form1: TForm1;implementation{$R *.dfm}class procedure TMessageHandler.AppMessage(var Msg: TMsg; var Handled: Boolean);begin if Msg.message=WM_KEYDOWN then if (Msg.w... 阅读全文

posted @ 2013-10-21 13:15 大悟还俗_2 阅读(249) 评论(0) 推荐(0) 编辑

摘要: ss[1]//var ss:String;和Pointer(ss)^是不是一个意思呢? 答:不是。ss[1]表示第一个字符。如:ss:='abc'则表示'a'。ss[0]=Length(ss);Pointer(ss)^ 和 @s 也不一样。就连 cc:PCharPointer(cc)^ 和 @cc 也不一样。 应用:一、发送字符串 或者 Record procedure SendStr(ss:String);var cds:TCopyDataStruct;hh:HWND;begin hh:=FindWindow('TfrmFYErpMsg',ni 阅读全文

posted @ 2013-10-21 13:12 大悟还俗_2 阅读(184) 评论(0) 推荐(0) 编辑

摘要: 一、override 重载type TFigure = class procedure Draw; virtual;//(我的理解是)父类中可以使用父类的,子类中使用子类的。与“四”是有区别的。 end; TRectangle = class(TFigure) procedure Draw; override;//a1 end; TEllipse = class(TFigure) procedure Draw; override;//a2 end;使用var Figure: TFigure;begin Figure := TRectangle.Create;... 阅读全文

posted @ 2013-10-21 13:11 大悟还俗_2 阅读(308) 评论(0) 推荐(0) 编辑

摘要: 今天用到压缩文件的问题,找了一些网上的资料,后来发现了delphi自身所带的zlib单元,根据例子稍微改变了一些,使它能够符合所有的格式。使用时,需要Zlib.pas和 Zlibconst.pas两个单元文件,这两个文件保存在 Delphi 5.0安装光盘上 InfoExtrasZlib目录下,此外,在 InfoExtrasZlibObj目录中还保存了 Zlib.pas单元引用的 Obj文件,把这个目录拷贝到delphi的lib下,即可。原来提供的例子是抓计算机屏幕,现在改成文件流,适应所有情况。也可以适当的改动比如增加目录压缩和分文件压缩,其实就是在文件流前面增加一部分描述结构就是,不多说。 阅读全文

posted @ 2013-10-21 13:06 大悟还俗_2 阅读(288) 评论(0) 推荐(0) 编辑

摘要: 字符描述\标记下一个字符是特殊字符或文字。例如,"n" 和字符 "n" 匹配。"\n" 则和换行字符匹配。序列 "\\" 和 "\" 匹配,而 "\(" 则和 "(" 匹配。^匹配输入的开头。$匹配输入的末尾。*匹配前一个字符零或多次。例如,"zo*" 与 "z" 或 "zoo" 匹配。+匹配前一个字符一次或多次。例如,"zo+" 与 "zoo" 匹配,但和 阅读全文

posted @ 2013-10-21 09:25 大悟还俗_2 阅读(216) 评论(0) 推荐(0) 编辑

摘要: 文件名称:Team Foundation Server 2010简体中文版文件大小:1.8 GBhttp://www.google.com/profiles/dedecms.com下载地址:thunder://QUFlZDJrOi8vfGZpbGV8Y25fdmlzdWFsX3N0dWRpb190ZWFtX2ZvdW5kYXRpb25fc2VydmVyXzIwMTBfeDg2X3g2NF9kdmRfNTMxOTA5Lmlzb3wxOTYzNTg5NjMyfEM5Qzc3QjI3MDdERjEwMDYyMUIzRkI2NTNDMjg1NTI0fC9aWg==/转载补充:Team Foundati 阅读全文

posted @ 2013-10-21 09:21 大悟还俗_2 阅读(549) 评论(0) 推荐(0) 编辑