07 2011 档案
摘要:unit Unit1;interface {接口部分开始}uses {引用单元列表,这是可选的,如果包含必须紧跟interface关键字} {接口部分声明常量/类型/变量/过程和函数,这些声明对引用单元就像自己的声明一样} {在接口部分声明的过程和函数,就像使用了forward关键字} {接口部分结束}implementation {实现部分}uses {如果包含uses字句,必须紧跟关键字implementation} {在这里实现interface中定义的过程和函数,可以任意顺序的定义和调用.} {在这里可以省略过程和函数的列表,如果包括,必须一样.} {可以定义单元私有的常量/类型(包括
阅读全文
摘要:Delphi数据类型C/C++ShorInt8位有符号整数charByte8位无符号整数BYTE,unsigned shortSmallInt16位有符号整数shortWord16位无符号整数unsigned shortInteger,LongInt32位有符号整数int,longCardinal,LongWord/DWORD32位无符号整数unsigned longInt6464位有符号整数_int64Single4字节浮点数float*Real486字节浮点数 Doubles8字节浮点数double*Extended10字节浮点数long doubleCurrency64位货币类型 TDa
阅读全文
摘要:转载至:http://bbs.itjsj.com/thread-334070-1-1.html近来,因工作需要,必须解决Delphi7写的主程序调用C#写的dll的问题。在网上一番搜索,又经过种种试验,最终证明有以下两种方法可行: 编写C#dll的方法都一样,首先在vs2005中创建一个“类库”项目TestDll,usingSystem.Runtime.InteropServices;namespaceTestDll{publicinterfaceITestClass{ voidYourProcedure(stirng param1); }[ClassInterface(ClassInter.
阅读全文
摘要:Windows 数据类型Delphi 数据类型描述LPSTRPAnsiChar字符串指针LPCSTRPAnsiChar字符串指针DWORDLongWord整数BOOLLongBool布尔型PBOOL^BOOL指向布尔值的指针PByte^Byte指向字节值的指针PINT^Integer指向整数值的指针PSingle^Single指向单精度浮点值的指针PWORD^Word指向16位值的指针PDWORD^DWORD指向32位值的指针LPDWORDPDWORD指向32位值的指针UCHARByte8位值(可用来表示字符)PUCHAR^Byte指向8位值的指针SHORTSmallint带符号16位整数UI
阅读全文
摘要:分类快捷键解释备注组件设计类Escape选择当前组件容器Shift + Click选择多个组件;选择窗体Tab选择下一个组件Shift + Tab选择上一个组件方向键选择此方向的下一个组件Ctrl + 方向键将所选组件的位置移动 1 个像素Shift + 方向键将所选组件的大小改变 1 个像素Ctrl + Shift + 方向键将所选组件的位置移动 1 个栅格Del删除所选组件Ctrl + 鼠标拖动选择一个容器内的多个组件可以一起修改共同属性Tab(在 Object Inspector 中使用)搜索属性或事件代码编辑类F1; Ctrl + F1光标所在单词的帮助Ctrl + Shift + E
阅读全文
摘要:指令参数存放位置参数传递顺序参数内存管理适用地点registerCPU寄存器从左到右被调用者默认,published 属性存取方法必须使用pascal栈从左到右被调用者向后兼容cdecl栈从右到左调用者调用 C++ 共享库stdcall栈从右到左被调用者API 调用safecall栈从右到左被调用者API 调用,如果回调函数;双接口方法必须使用其他指令near far export inline assemble 等,曾经在16下使用
阅读全文
摘要:分类运算符操作操作数结果类型范例算术运算符+加整数,实数整数,实数X + Y-减整数,实数整数,实数Result - 1*乘整数,实数整数,实数P * InterestRate/实数除整数,实数实数X / 2div整数除整数整数Total div UnitSizemod取模整数整数Y mod 6+(一元)符号等同整数,实数整数,实数+7-(一元)符号相反整数,实数整数,实数-X布尔运算符not否定布尔型Booleannot (C in MySet)and与布尔型BooleanDone and (Total > 0)or或布尔型BooleanA or Bxor异或布尔型BooleanA x
阅读全文
摘要://TStringList 常用方法与属性:var List: TStringList; i: Integer;begin List := TStringList.Create; List.Add('Strings1'); {添加} List.Add('Strings2'); List.Exchange(0,1); {置换} List.Insert(0,'Strings3'); {插入} i := List.IndexOf('Strings1'); {第一次出现的位置} List.Sort; {排序} List.Sorted :=
阅读全文
摘要:一:发送方View Code varhwnd:THandle;cpStruct:COPYDATASTRUCT;beginhwnd:=FindWindow(nil,PChar(FORMNAME));ifhwnd<>0thenbegincpStruct.dwData:=0;cpStruct.cbData:=length('test')+1;cpStruct.lpData:=pchar('test');SendMessage(Handle,WM_COPYDATA,0,Cardinal(@cpStruct));//lParam和wParam的顺序不能交换,具
阅读全文
摘要:; not allowed before ELSEElSE前不允许有“;”<clause> clause not allowed in OLE automation section在OLE自动区段不允许“<clause>”子句<name> is not a type identifier<name>不是类型标识符<name> not previously declared as a PROPERTY<name>前面没有说明PROPERTYGOTO <label> leads into or out of TRY
阅读全文
摘要:错误信息形式为: Run-time error nnn at xxxx; 其中nnn是运行时的错误编号; xxxx是运行时的错误地址.编号说明I/O错误: (编号100-149)100磁盘读错误,若要对超过格式文件尾进行读取时101磁盘写错误,若磁盘满时,由CloseFile,Write,Writeln或Flush报告102没有指定文件,若文件变量没有由Assign或AssignFile赋值,由Reset, Rewrite,Append,Rename和Erase报告103文件没有打开,若文件未打开,由CloseFile,Read,Write,Seek,Eof, FilePos,FileSize
阅读全文
摘要:在看 API 文档时, 我们经常见到 GetLastError; 它可以返回操作后系统给的提示.但 GetLastError 返回的只是一个信息代码, 如何返回对应的具体信息呢?FormatMessage 可以, 但这个函数太复杂了; 可以用 SysErrorMessage 代替它.举例:var err: string; ErrorCode: DWORD;begin ErrorCode:=GetLastError; ShowMessage(IntToStr(ErrorCode)); err := SysErrorMessage(ErrorCode); ShowMessage(err); {操作
阅读全文
摘要:一:创建DLLView Code library DemoDll;{ Important note about DLL memory management: ShareMem must be thefirst unit in your library's USES clause AND your project's (selectProject-View Source) USES clause if your DLL exports any procedures orfunctions that pass strings as parameters or function re
阅读全文
摘要://通过 DLL Wizard 建立: View Code library TestDll;{ Important note about DLL memory management: ShareMem must be thefirst unit in your library's USES clause AND your project's (selectProject-View Source) USES clause if your DLL exports any procedures orfunctions that pass strings as parameters o
阅读全文
摘要:/*创建触发器[T_INSERT_卷烟销售表],该触发器较复杂。说明: 每当[卷烟库存表]发生 INSERT 动作,则引发该触发器。触发器功能: 实现业务规则。业务规则: 如果销售的卷烟品牌不存在库存或者库存为零,则返回错误。否则则自动减少[卷烟库存表]中对应品牌卷烟的库存数量和库存金额。*/IF EXISTS (SELECT NAME FROM SYSOBJECTS WHERE XTYPE = ’TR’ AND NAME = ’T_INSERT_卷烟销售表’)DROP TRIGGER T_INSERT_卷烟销售表GOCREATE TRIGGER T_INSERT_卷烟销售表ON 卷烟销售表F
阅读全文
摘要:定义: 何为触发器?在SQL Server里面也就是对某一个表的一定的操作,触发某种条件,从而执行的一段程序。触发器是一个特殊的存储过程。 常见的触发器有三种:分别应用于Insert , Update , Delete 事件。 我为什么要使用触发器?比如,这么两个表: Create Table Student( --学生表 StudentID int primary key, --学号 .... ) Create Table BorrowRecord( --学生借书记录表 BorrowRecord int identity(1,1), --流水号 StudentID int , --学号 Bo
阅读全文
摘要:一:新建DLLView Code library TestMDIDll;{ Important note about DLL memory management: ShareMem must be thefirst unit in your library's USES clause AND your project's (selectProject-View Source) USES clause if your DLL exports any procedures orfunctions that pass strings as parameters or function
阅读全文
摘要:SQL时间格式转换:View Code 年月日SELECT CONVERT(varchar, GETDATE(), 102) AS DateTime--2011.07.12SELECT CONVERT(varchar, GETDATE(), 111) AS DateTime--2011/07/12SELECT CONVERT(varchar(10), GETDATE(), 120) AS DateTime--2011-07-12SELECT CONVERT(varchar, GETDATE(), 112) AS DateTime--20110712SELECT CONVERT(varchar,
阅读全文
摘要:1 连接远程服务器procedure Connect(AAutoLogin: boolean; const ATimeout: Integer);2 改变目录procedure ChangeDir(const ADirName: string);3 下载procedure Get(const ASourceFile: string; ADest: TStream; AResume: Boolean); overload;procedure Get(const ASourceFile: string; const ADestFile: string; const ACanOverwrite: b
阅读全文
摘要:假设有张学生成绩表(tb)如下:Name Subject Result张三 语文 74张三 数学 83张三 物理 93李四 语文 74李四 数学 84李四 物理 94想变成 姓名 语文 数学 物理 ---------- ----------- ----------- ----------- 李四 74 84 94张三 74 83 93SQL 语句如下:create table tb( Name varchar(10) , Subject varchar(10) , Result int)insert into tb(Name , Subject , Result) values('张三
阅读全文
摘要:首先下载SuperObject 代码包官网 http://www.progdigy.com/?page_id=6下载地址 http://code.google.com/p/superobject/downloads/list官方论坛 http://www.progdigy.com/forums/viewforum.php?f=5好,开始例子var obj: ISuperObject;begin obj := SO('{"foo": true}'); //创建对象 memo1.lines.add(obj.asobject.s['foo']);/
阅读全文
摘要:使用串口SPCOMM接收数据的时候0x11和0x13无法接受,从时间间隔上看来可以接收,但是无法显示。网上查错误得:------------------------------------------------------------------------OutX_XonXOffFlow/InX_XonXoffFlow:这个属性是指进行发送/接收时的软件握手标志,两个握手信号之间的数据被认为是通讯数据,收到握手信号后,通讯就中止了。FOutx_XonXoffFlow := True;FInx_XonXoffFlow := True;XOffChar/XOnChar:这是指握手的字节,默认的
阅读全文
摘要:unit Unit1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls;typeTForm1 =class(TForm)Button1: TButton;Button2: TButton;Button3: TButton;procedure Button1Click(Sender: TObject);procedure Button2Click(Sender: TObject);procedure Button3Click(Sender
阅读全文
摘要:构建一个Json的常用方法:从字符串、从文件、从流unit Unit1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls;typeTForm1 =class(TForm)Button1: TButton;Button2: TButton;Button3: TButton;Button4: TButton;procedure Button1Click(Sender: TObject);procedure Button2Click(Send
阅读全文
摘要:一:现在有Json数据{"message":"","data":{"name": "张三", /* 注释 */"age": 33,"sex": true,"weight": 123.456,"tel": ["86-1111111", "86-2222222"],"addresses":{"address":"A省B市"
阅读全文
摘要:JSON(JavaScript Object Notation) 类似与 XML; 虽始于 JavaScript, 但被多种语言支持, 它也成了 Delphi 2009 的新功能之一.DlephiX版本superobject类下载地址:http://code.google.com/p/superobject/downloads/list假如有一段 XML:<id>2</id><name>张三</name><age>99</age>用 json 可以表示为:{"id":2, "name"
阅读全文
摘要:一:新建所需测试单元unit UFunction;interfacetypeTMyfun=class(TObject)publicfunction GetMyAge(Birthday:TDateTime):Integer;end;implementationuses SysUtils,DateUtils;{ TMyfun }function TMyfun.GetMyAge(Birthday: TDateTime): Integer;varsyear,smonth,sday:Word;byear,bmoth,bday:Word;beginsyear:=YearOf(Now);//DecodeDa
阅读全文
|