随笔分类 -  Delphi 语句/函数

一句话的魅力!
摘要:uses ActiveX, ComObj; function GetWMIProperty(WMIType, WMIProperty:AnsiString):String; var Wmi, Objs, Obj:OleVariant; Enum:IEnumVariant; C:Cardinal; begin try Wmi:= CreateOleObject(An... 阅读全文
posted @ 2017-08-04 11:41 冰意 LceMeaning 阅读(1180) 评论(0) 推荐(0)
摘要:方法一: 在WebBrowser的OnDocumentComplete事件书写代码。 方法二: 阅读全文
posted @ 2017-05-17 09:43 冰意 LceMeaning 阅读(1896) 评论(0) 推荐(0)
摘要:在XE7下测试通过. 阅读全文
posted @ 2016-07-09 11:29 冰意 LceMeaning 阅读(525) 评论(0) 推荐(0)
摘要:加载界面后再运行代码段 阅读全文
posted @ 2016-05-16 10:05 冰意 LceMeaning 阅读(286) 评论(0) 推荐(0)
摘要:settimer(self.handle,0,5000,@timerfun); //定义引用 //执行事件 procedure timerfun(handle:Thandle;msg:word;identer:word;dwtime:longword);stdcall; begin showmessage('事件激活'); killtimer(handle,identer);//关... 阅读全文
posted @ 2016-05-13 15:05 冰意 LceMeaning 阅读(181) 评论(0) 推荐(0)
摘要://输入事件中将字母设置为大写 if Key in ['a'..'z'] then begin Key := UpperCase(key)[1]; end;//DBGrid排序方法procedure TForm1.DBGridEh1TitleBtnClick(Sender: ... 阅读全文
posted @ 2015-09-16 11:42 冰意 LceMeaning 阅读(334) 评论(0) 推荐(0)
摘要:以下代码本人在Delphi XE2下编译通过==================================================================unit Unit1;interfaceuses Winapi.Windows, Winapi.Messages, Sys... 阅读全文
posted @ 2015-02-11 09:45 冰意 LceMeaning 阅读(285) 评论(0) 推荐(0)
摘要:uses Windows;procedure TformLogin.FormCreate(Sender: TObject);begin SetWindowLong(Handle,GWL_EXSTYLE,(GetWindowLong(handle,GWL_EXSTYLE) or WS_EX_... 阅读全文
posted @ 2015-01-09 17:22 冰意 LceMeaning 阅读(332) 评论(0) 推荐(0)
摘要:function MakeFileList(Path,FileExt:string):TStringList ;var sch:TSearchrec;begin Result:=TStringlist.Create; if rightStr(trim(Path), 1) '\' then ... 阅读全文
posted @ 2014-12-31 16:16 冰意 LceMeaning 阅读(329) 评论(0) 推荐(0)
摘要:以下代码经本人在Delphi XE2 下通过编译uses Comobj;procedure EXCEL1Click(Sender: TObject);const BeginRow= 1; BeginCol= 2;var iRE, I :Integer; iRow,iCol :Integer... 阅读全文
posted @ 2014-05-28 16:33 冰意 LceMeaning 阅读(1357) 评论(0) 推荐(0)
摘要:以下在编写IC卡项目时出现卡号转换错误时的解决方法,在XE2下测试正常。================================================uses math;function HexToDec(Hex : string) : string;var i : intege... 阅读全文
posted @ 2014-05-09 17:58 冰意 LceMeaning 阅读(343) 评论(0) 推荐(0)
摘要:uses ShareMem;type TArray = array of Integer;function CreateRandom(ResultCount, MaxInt: Integer) : TArray;var // 生成个数 最大数值 I, N... 阅读全文
posted @ 2014-04-24 16:30 冰意 LceMeaning 阅读(2130) 评论(0) 推荐(0)
摘要:edt2.Text := FormatFloat('0.00',StrToFloat(edt1.Text)); //按格式输出Params.Add('c='+Utf8ToAnsi(UTF8Encode(trim(Memo1.Text)))); //将Memo1.text转为UTF8编码格式 阅读全文
posted @ 2014-01-08 15:37 冰意 LceMeaning 阅读(207) 评论(0) 推荐(0)
摘要:一、创建互斥对象在工程project1.dpr中创建互斥对象Program project1UsesWindows,Form,FrmMain in 'FrmMain.pas' {MainForm}; {$R *.res} var hAppMutex: THandle; //声明互斥变量 begin hAppMutex := CreateMutex(nil, false,’projectname’); //创建互斥对象projectname工程名称 if ( (hAppMutex 0) and (GetLastError() = ERROR_AL... 阅读全文
posted @ 2013-11-16 17:21 冰意 LceMeaning 阅读(508) 评论(0) 推荐(0)
摘要:需求:增加年(月、日) 声明:function IncYear ( const StartDate : TDateTime {; NumberOfYears : Integer = 1} ) : TDateTime;描述:IncYear函数将传递进来的StartDateTime参数加上NumberOfYears数量的年数。增减的数量是可选的,默认为1。增加年份后,如果日期数对于当前年月而言太大的话,它会自动缩减为当前年月的最大日期值。例: IncYear(now);//当前日期加1年 IncYear(now, 5);//当前日期加5年 IncYear(now, -1);//当前日期减1年需要操 阅读全文
posted @ 2013-11-09 16:56 冰意 LceMeaning 阅读(781) 评论(0) 推荐(0)
摘要:MessageBox(Handle,'警告信息框','警告信息框',MB_ICONWARNING); //警告信息框MessageBox(Handle,'疑问信息框','疑问信息框',MB_ICONQUESTION); //疑问信息框MessageBox(Handle,'错误信息框','错误信息框',MB_ICONERROR); //错误提示框MessageBox(Handle,'提示信息框','提示信息框',MB_ICONASTERISK); //提示信息框Mess 阅读全文
posted @ 2013-11-06 11:17 冰意 LceMeaning 阅读(238) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2013-10-15 10:15 冰意 LceMeaning 阅读(2) 评论(0) 推荐(0)
摘要:unit Unit1;interfaceuses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;type TForm1 = class(TForm) btn1: TButton; btn2: TButton; Label1: TLabel; Label2: TLabel; Label3: TLabel; p... 阅读全文
posted @ 2013-10-14 11:30 冰意 LceMeaning 阅读(1548) 评论(0) 推荐(0)
摘要:(一) 使用动态创建的方法首先创建 Excel 对象,使用ComObj:var ExcelApp: Variant;ExcelApp := CreateOleObject( 'Excel.Application' );1) 显示当前窗口:ExcelApp.Visible := True;2) 更改 Excel 标题栏:ExcelApp.Caption := '应用程序调用 Microsoft Excel';3) 添加新工作簿:ExcelApp.WorkBooks.Add;4) 打开已存在的工作簿:ExcelApp.WorkBooks.Open( 'C:/ 阅读全文
posted @ 2013-10-12 18:25 冰意 LceMeaning 阅读(392) 评论(0) 推荐(0)
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Vcl.ExtCtrls,Clipbrd;type TForm1 = class(TForm) Button1: TButton; img1: TImage; procedure Button1Click(Sender: TObject); private { Private declarations } public ... 阅读全文
posted @ 2013-10-12 18:14 冰意 LceMeaning 阅读(236) 评论(0) 推荐(0)