随笔分类 -  delphi

摘要:class function或class 类函数\类过程. 它们是直接操作在类上面(没有实例化的对象)下面是Delphi Help 的描述 A class method is a method (other than a constructor) that operates on classes instead of objects. The definition of a class method must begin with the reserved word class. For example, type TFigure = class public class funct... 阅读全文
posted @ 2012-03-20 11:49 马儿快跑 阅读(4041) 评论(0) 推荐(0)
摘要:一个Delphi下Abstract Error问题的处理 分类: PASCAL应用(Delphi) 2011-07-18 09:49 434人阅读 评论(0) 收藏 举报 今天在修改一个公司项目的时候出现了Abstract Error问题,在网上查找之后发现为纯虚函数引起.但是看了代码之后,发现该类的子类的同名函数也实现了.这是什么原因呢?后来终于找了原因.T1 = Class(TObject) //这个我们假设是基类public function f1();virtual;abstract;T1s = Class(T1) //这个是我们用到的类的父类public function f1(); 阅读全文
posted @ 2012-02-08 16:09 马儿快跑 阅读(8303) 评论(0) 推荐(0)
摘要:Delphi 调用VC的DLLVC中DLL声名格式: Extern “C” void __declspec(dllexport) __stdcall ShowMess(HWND hwnd, char* mess);输出格式为:_ShowMess@8,“8”为函数参数字节数为了避免名称分裂,可采用以下方法解决:1.声明中不加__stdcall,采用VC默认格式__cdecl,但在Delphi中要注明调用格式为cdecl。2.在VC工程中添加def文件,如:LIBRARYEXPORTSShowMess @1则DLL中输出函数名称不分裂。Delphi中调用格式: Procedure ShowMess 阅读全文
posted @ 2012-01-05 23:17 马儿快跑 阅读(4167) 评论(0) 推荐(0)
摘要:Delphi与C语言类型转换对照2010-10-06 20:53:49|分类: 默认分类 |标签: |字号大中小订阅 When converting C function prototypes to Pascal equivalent declarations, it's important to substitute the C function and argument types with the correct Pascal types. I often use a Type Translation Table for this, like the following in t 阅读全文
posted @ 2012-01-03 21:14 马儿快跑 阅读(4242) 评论(0) 推荐(0)
摘要:支持Delphi2009/2010的DES加密单元作者:garfieldtom来源:博客园发布时间:2009-11-12 15:27阅读:444 次原文链接 [收藏] 原来在D7/D2007下使用过一个DES的加密单元,但到了D2009/D2010后因为String被映射为unicodestring,不再是AnsiString,所以加密解密字符串失去了作用。经过修改,可以正确使用了,主要修改其中的string,显示指定为AnsiString,char,显示指定为AnsiChar.unit DESCrypt;interfaceusesSysUtils,Classes;typeTByte32 = 阅读全文
posted @ 2011-12-31 10:32 马儿快跑 阅读(3015) 评论(0) 推荐(2)
摘要:unit Des;interfaceuses SysUtils;type TKeyByte = array[0..5] of Byte; TDesMode = (dmEncry, dmDecry); function EncryStr(Str, Key: String): String; function DecryStr(Str, Key: String): String; function EncryStrHex(Str, Key: String): String; function DecryStrHex(StrHex, Key: String): String;const BitIP: 阅读全文
posted @ 2011-12-31 10:32 马儿快跑 阅读(405) 评论(0) 推荐(0)
摘要:~Delphi const 杂谈~ {*********************************************}{ Delphi const 杂谈 }{ ------------------- }{ }{ CopyRight (c) 2010 Tibetwolf2046 }{ 自由转载,需注明出处 }{*********************************************} Ok, 我想谈谈Object Pascal中关于const的一些事,起因是我发现一方面Object Pascal中关于const的说明很少,另一方面在现实中存在对其的许多误用。当然,我 阅读全文
posted @ 2011-12-28 11:50 马儿快跑 阅读(333) 评论(0) 推荐(0)
摘要:PINGWindows supports an Internet Control Message Protocol (ICMP) to determine whether or not a particular host is available. ICMP is a network layer protocol that delivers flow control, error messages, routing, and other data between Internet hosts. ICMP is primarily used by application developers f 阅读全文
posted @ 2011-12-28 11:49 马儿快跑 阅读(515) 评论(0) 推荐(0)
摘要:众所周知,Delphi ListView类直接进行Add、Update、Delete操作的速度是比较慢的,尤其是当数据量较大时,比如数据量达到5000、10000、50000时,速度真是可以说是“慢得惊人”。其实快速操作的方法非常简单,就当大家都知道了。在本人的工作中,很多项目都用到ListView,并且对速度的响应要求比较高,于是发生了快速操作ListView的代码散布于多个项目大量模块中的问题,并且,当界面层数据显示要求发生改变时,自然发生“重复性代码的通用问题”。考虑到对以前版本的兼容性问题,也一直没有引用第三方的成熟组件。鉴于:“程序中的重复代码最易引发问题,必须消除”的实践经验,自己 阅读全文
posted @ 2011-12-27 16:30 马儿快跑 阅读(4180) 评论(0) 推荐(0)
摘要:delphi中有直接把10进制转换成16进制的函数: function IntToHex(Value: Integer; Digits: Integer): string; overload; function IntToHex(Value: Int64; Digits: Integer): string; overload;使用方法为:procedure TForm1.Button1Click(Sender: TObject);var i,m: Integer;beginLabel1.Caption := '';for i := 1 to Le... 阅读全文
posted @ 2011-12-22 11:18 马儿快跑 阅读(22319) 评论(1) 推荐(0)
摘要:procedure TForm1.Button1Click(Sender: TObject); const s = 'abcd1234'; var arr: array of Byte; i: integer; s2: string; begin //string to byte array SetLength(arr,Length(s)); CopyMemory(arr,PChar(s),Length(s)); for i := 0 to High(arr) - 1 do ShowMessage(chr(arr[i])); //byte array to string Set 阅读全文
posted @ 2011-12-22 10:33 马儿快跑 阅读(4163) 评论(0) 推荐(0)
摘要:Delphi 与 C/C++ 数据类型对照表 Delphi数据类型C/C++ShorInt8位有符号整数charByte8位无符号整数BYTE,unsigned shortSmallInt16位有符号整数shortWord16位无符号整数unsigned shortInteger,LongInt32位有符号整数int,longCardinal,LongWord/DWORD32位无符号整数unsigned longInt6464位有符号整数_int64Single4字节浮点数float*Real486字节浮点数 Double8字节浮点数double*Extended10字节浮点数long dou 阅读全文
posted @ 2011-12-22 09:50 马儿快跑 阅读(461) 评论(0) 推荐(0)
摘要:delphi 汉字的编码 转换2009-10-07 21:57:00|分类: delphi |标签: |字号大中小订阅 ━━━━━━━━━━━━━━━━━━━━━━━━━━varStr:String;beginStr:='张';Caption:=IntToHex(PWord(@Str[1])^,4);end;━━━━━━━━━━━━━━━━━━━━━━━━━━这样也行a:='我';caption:=IntToStr(ord(a[1]))+IntToStr(ord(a[2]));━━━━━━━━━━━━━━━━━━━━━━━━━━Caption:=IntToHex 阅读全文
posted @ 2011-12-22 08:35 马儿快跑 阅读(5534) 评论(1) 推荐(0)
摘要:Delphi 的字符及字符串[2] - Char、AnsiChar、WideChar、PChar、PAnsiChar、PWideChar//单字符 Char、AnsiChar (在目前版本(2007)中, 它们是一回事, 只有 1 字节大小)var c: Char; {Char 类型的取值范围是: #0..#255, 用十六进制表示是: #$0..#$FF}begin {用十进制方式赋值:} c := #65; ShowMessage(c); {A} {用十六进制方式赋值:} c := #$41; ShowMessage(c); {A} {用 Chr 函数代替 # 符号} c := Chr(6 阅读全文
posted @ 2011-12-21 15:45 马儿快跑 阅读(728) 评论(0) 推荐(0)