Where is my way?

 

随笔分类 -  Delphi技巧

Delphi数组索引
摘要:语法:Property 属性名[索引值]:属性类型 read 方法名 write 方法名TArrayProperty = class private FValues:array[0..1000] of string; procedure SetValue(const index:Integer;const Value:string); function GetValue(const index:Integer):string; public property Values[x:integer]:string read GetValue write Se... 阅读全文

posted @ 2012-02-01 22:40 ManLoveGirls 阅读(658) 评论(0) 推荐(0)

Delphi属性索引
摘要:索引说明来使多个属性共用一个访问方法来设置属性的值.属性声明中读、写属性的说明必须是方法,read后面的方法必须附加一个整型的参数,write后的过程方法必须在参数表的倒数第2个参数位置附加一个整形的参数type TProperty = class private FPosition: array[0..2] of Integer; function GetPosition(const Index:Integer):Integer; procedure SetPosition(const Index,Value:Integer); public... 阅读全文

posted @ 2012-02-01 22:32 ManLoveGirls 阅读(1436) 评论(0) 推荐(0)

delhi从数据库导出数据生成Excel并自动发送邮件笔记
摘要:function TMainForm.CreateExcel(Customer:String): OleVariant;var Excel,Sheet,workBook:OleVariant;begin Excel := CreateOleObject('et.Application'); Excel.application.workbooks.add;//newe xls file Excel.Visible := False; // not display Excel.DisplayAlerts := False; Excel.WorkBooks[1].Worksh... 阅读全文

posted @ 2011-10-13 18:43 ManLoveGirls 阅读(882) 评论(0) 推荐(0)

delphi工作笔记利用indy10发送邮件
摘要://邮件发送typeTEmailState = (esBegin,esSending,esEnd,esFaild);EMailState = TEmailState;TSendEmail= class private FHost:string;//主机 FUserName:String;//用户名 FEmail: TStringList;//收件人邮箱列表 FEmailMsg: string; //邮件正文 FSenderEmail: string;//发送人 FSubject: string;//主题 FiPort: Integer;//端口 ... 阅读全文

posted @ 2011-10-09 20:12 ManLoveGirls 阅读(3412) 评论(1) 推荐(3)

delphi 发送鼠标点击消息到指定窗口
摘要:SendMessage(handle,WM_LButtonDown,0,lparam)主要是计算lparammsdn中介绍坐标x在低位,y在高位实现方法就是x+(y左移16位)procedure Play(pa,pb:TPoint);var Gameh:HWND; lparam:DWORD; p1,p2:TPoint;begin///第一点坐标///用spy++得到数据///<summer>起始点为x=272,y=99</summer>/// pa.x得到偏移地址p1.X:=272+48*pa.X-30;p1.Y:=99+48*pa.Y-30;p2.X:=272+48* 阅读全文

posted @ 2011-10-03 00:35 ManLoveGirls 阅读(5132) 评论(0) 推荐(1)

Delphi动态创建组件
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,stdctrls;type TForm2 = class(TForm) procedure FormClose(Sender: TObject; var Action: TCloseAction); private public //拦截Left mouse down 消息 procedure WMMOUSEDOWN(var Msg:TWMLButt... 阅读全文

posted @ 2011-10-02 01:40 ManLoveGirls 阅读(1167) 评论(0) 推荐(0)

delphi 动态数组
摘要:在设计一些需要数组的例程时,可能不知道该数组中会需要多少个元素,可能是10个,100个,1000个等.这些都只有到了实际运行的时候才能得到答案.由于对数组不确定大小,因此很难将数组声明一个局部变量(声明过大,会使栈负担过重),所以在堆上进行分配.delphi支持的第一种技术type PMyArray:^TMyArray; TMyArray : Array[0..0] of TMyType; //声明一个TMyType类型的数组begin GetMem(PMyArray,42 * SizeOf(TMyType));//分配42个TMyType内存大小 //释放PMyArray Free... 阅读全文

posted @ 2011-09-27 21:36 ManLoveGirls 阅读(4433) 评论(0) 推荐(0)

Delphi工作笔记-从表格中导入数据到数据库
摘要:今天要更新预算项目,由客户整理好编号 名称 级别由于要按树结构格式排列,所以写了一个游标去处理先由 sqlserver2000 企业管理器将内容导入declare @ID uniqueidentifierdeclare @Code UCode --varchar(50)declare @TreeLevel intDeclare c cursor forSelect ID,Code,TreeLevel from 结果 ORDER BY Codeopen cfetch next from c into @ID, @Code, @TreeLevelwhile @@fetch_... 阅读全文

posted @ 2011-09-22 22:53 ManLoveGirls 阅读(399) 评论(0) 推荐(0)

Delphi工作笔记-从wps表格导入数据更新
摘要:网上看了一篇文章.简直是坑爹!uses comobject;procedure TBaseMaterielPreForm.Button1Click(Sender: TObject);const BeginRow = 3; BeginCol = 2;//开始列 开始行//列对应A B C D E F G//行对应 1 2 3 4 4 5 var Excel: OleVariant; iRow,iCol : integer; xlsFilename: string; buffer:PChar;begin OpenDialog1.Title := '请选择正确的excel文件'; . 阅读全文

posted @ 2011-09-19 15:29 ManLoveGirls 阅读(2281) 评论(0) 推荐(0)

导航