张志峰的博客

水滴石川,积少成多。

导航

随笔分类 -  Delphi

摘要:@echo 开始注册copy dcc70.dll %windir%\system32\regsvr32 %windir%\system32\dcc70.dll /s@echo dcc70.dll注册成功@pause@echo 开始注册copy dcc70.dll %windir%\SysWOW64\... 阅读全文

posted @ 2015-12-21 16:32 ╰★张志峰★╮ 阅读(621) 评论(0) 推荐(0) 编辑

摘要:(1)var修饰符添加var 是地址传递,会修改原有的变量vars: string;beginS := 'Hello';ChangeSVar(s);ShowMessage(S);end;// ChangeSVar 定义procedure TForm1.ChangeSVar(var A: string... 阅读全文

posted @ 2015-06-17 17:15 ╰★张志峰★╮ 阅读(610) 评论(0) 推荐(0) 编辑

摘要://取当月的第一天function TDealWithXML.FDOM(Date: TDateTime): TDateTime;var Year, Month, Day: Word;begin DecodeDate(Date, Year, Month, Day); Result := Enco... 阅读全文

posted @ 2015-05-26 18:35 ╰★张志峰★╮ 阅读(696) 评论(0) 推荐(0) 编辑

摘要:NthDayOfWeek计算并返回指定日期是该月第几周Unit:DateUtilsfunctionNthDayOfWeek(constAValue: TDateTime): Word;Example:UsesSysUtils,DateUtils;Begin Write('Today is the '... 阅读全文

posted @ 2015-05-26 18:09 ╰★张志峰★╮ 阅读(1658) 评论(0) 推荐(0) 编辑

摘要:在delphi中, reintroduce作用当在子类中重载或者重新声明父类的虚方法时,使用 reintroduce 关键字告知编译器,可以消除警告信息.如: TParent = class procedure proc;virtual; end; TChild = class(TParent) p... 阅读全文

posted @ 2015-03-06 15:46 ╰★张志峰★╮ 阅读(713) 评论(0) 推荐(0) 编辑

摘要:最近整理前人的代码,有好多的hint和waring, 其中整理到Method 'CreateNew' hides virtual method of base type 'TCustomForm', 搞了好一会, 记录下来。之前这个方法没有加上reintroduce;overload; Reintr... 阅读全文

posted @ 2014-12-03 10:57 ╰★张志峰★╮ 阅读(958) 评论(0) 推荐(0) 编辑

摘要:这时因为在.pas文件中存在delphi无法识别的编码,也就是说.pas文件中的字符并非是纯粹的可由文本文件编辑器所能识别的编码。所以,delphi就不可能有效地解释这些编码。因而就出现了自动代码提示功能失效的错误。将.pas文件拷贝到ultraEdit中保存一下,再打开复制出文本拷贝回delphi... 阅读全文

posted @ 2014-10-13 16:21 ╰★张志峰★╮ 阅读(1692) 评论(0) 推荐(0) 编辑

摘要:result有默认值的int类型的为0,string类型的为‘’,tobject类型的为nil等等 阅读全文

posted @ 2014-09-03 14:08 ╰★张志峰★╮ 阅读(682) 评论(0) 推荐(0) 编辑

摘要:今天在打开一个Delphi窗体时报了这么一个错误: Corrupt Portfolio Stream查了一下,主要是由于Delphi窗体的*.ddp文件损坏引起的.解决方法: 删除.ddp 文件,重新打开窗体即可。有时候还是不行,这个时候用记事本打开 那个.dfm文件,通常窗体都是以Text形式存储... 阅读全文

posted @ 2014-05-16 10:43 ╰★张志峰★╮ 阅读(1230) 评论(0) 推荐(0) 编辑

摘要:SysUtilsprocedure DecodeData(Date: TDateTime; var Year, Month, Day: Word);DecodeDate打断TdateTime成为年月日的值。DecodeDate打断由Date参数说明的值成为年月日的值。如果TDateTime值是小于或等于0,那么返回的年月日值为0;这个例子使用一个按纽和两个标签,当按击按钮时,当前的日期和时间就会出现在两个标签的标题中显示。procedure TForm1.Button1Click(Sender: TObject);var Present: TDateTime;Year, Month, Day, 阅读全文

posted @ 2014-02-28 16:30 ╰★张志峰★╮ 阅读(2943) 评论(0) 推荐(0) 编辑

摘要:ADO是Microsoft存取通用数据源的标准引擎。ADO通过封装OLE DB而能够存取不同类型的数据,让应用程序能很方便地通过统一的接口处理各种数据库。ADO由一组COM对象组成,每一个不同的原生ADO对象负责不同的工作。下面,向大家介绍如何使用原生ADO对象的动态属性来实现ADO的高级功能。 ADO原生对象关系图: Connection Errors→Error Command→Parameters→Parameter RecordSet→Fields→Field 一、存取原生ADO对象 Delphi中的ADO组件页中的组件为我们通过ADO技术访问数据库提供了方便。这些组... 阅读全文

posted @ 2014-01-23 15:15 ╰★张志峰★╮ 阅读(1735) 评论(0) 推荐(0) 编辑

摘要:FieldByName('e').AsBoolean = false 其中e为 sql server 中的bit类型. 阅读全文

posted @ 2014-01-07 17:30 ╰★张志峰★╮ 阅读(610) 评论(0) 推荐(0) 编辑

摘要:function GetFlag(a: string): Integer;var I: Integer;begin Result := 0; for I := 0 to 3 - 1 do begin if a = '0' then Result := Result or 1 else Result := Result or 2; end;end;procedure TForm1.Button1Click(Sender: TObject);var I: Integer;begin I := GetFlag('3'); ShowMessage(IntToStr... 阅读全文

posted @ 2013-12-30 14:46 ╰★张志峰★╮ 阅读(392) 评论(0) 推荐(0) 编辑

摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type t1 = class a: string; b: string; end; TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure Button2Click(Sender: TObject); procedure Button1Cl... 阅读全文

posted @ 2013-12-10 21:02 ╰★张志峰★╮ 阅读(314) 评论(0) 推荐(0) 编辑

摘要:Delphi 自带的那个 Hand 光标很难看?没关系,一行代码解决问题:Screen.Cursors[crHandPoint] := LoadCursor(0, IDC_HAND);放在主窗体 OnCreate 事件里,或放在任意一个单元 initialization 节都可以。同样的方法还可以替换掉其它感觉不爽的默认光标。 阅读全文

posted @ 2013-12-05 19:32 ╰★张志峰★╮ 阅读(511) 评论(0) 推荐(0) 编辑

摘要:在执行程序的时候总是提示:---------------------------Debugger Exception Notification---------------------------Project PrintErp.exe raised exception class EVariantTypeCastError with message '无法将变量从类型 (String) 转换为类型 (Double)。'. Process stopped. Use Step or Run to continue.---------------------------OK Hel 阅读全文

posted @ 2013-09-16 16:50 ╰★张志峰★╮ 阅读(1112) 评论(0) 推荐(0) 编辑

摘要:我的电脑:SaveDialog1.InitialDir := '::{20D04FE0-3AEA-1069-A2D8-08002B30309D}';// My Computer {20D04FE0-3AEA-1069-A2D8-08002B30309D}// Network Neighborhood {208D2C60-3AEA-1069-A2D7-08002B30309D}// Recycled {645FF040-5081-101B-9F08-00AA002F954E}另外可使用SHGetSpecialFolder获取其它Windows虚拟文件夹,相关函数和常数定义于Shl 阅读全文

posted @ 2013-08-12 11:24 ╰★张志峰★╮ 阅读(932) 评论(0) 推荐(0) 编辑

摘要:有时在Delphi使用指针类型的数据,总是提示如下:[Warning] FGroupFeedBack.pas(796): Unsafe typecast of 'Pointer' to 'TObject'[Warning] FGroupFeedBack.pas(696): Unsafe type 'PChar'比较烦,虽说不是bug,但是看着不爽。做程序最好做到没有waring和hints.说说怎么关闭这个waring, 其他的waring需要找出代码的不完善行,后改善,但这种waring只可以用编译命令来关闭了, 在单元的{$R *.DFM} 阅读全文

posted @ 2013-08-02 13:47 ╰★张志峰★╮ 阅读(1310) 评论(0) 推荐(0) 编辑

摘要:Display PreferencesWarning messages (Delphi)Go Up to Delphi Compiler Directives (List) IndexTypeSwitchSyntax{$WARN identifier ON | OFF | ERROR | DEFAULT}DefaultAll warnings are enabledScopeLocalRemarksThe $WARN directive gives you fine-grained control over individual warning messages.Syntax Effect{$ 阅读全文

posted @ 2013-08-02 13:34 ╰★张志峰★╮ 阅读(2791) 评论(0) 推荐(1) 编辑

摘要:delphi 编译的时候 把Warning去除的方法在添加{$WARNINGS OFF} 阅读全文

posted @ 2013-08-02 11:35 ╰★张志峰★╮ 阅读(400) 评论(0) 推荐(0) 编辑