Delphi的HashTable
{-----------------------------------------------------------------------------
Unit Name: HashTable
Author: LiuHeng
Date: 2010-04-13
Purpose: 封装Delphi的HashTable
History:
-----------------------------------------------------------------------------}
unit HashTable;
interface
uses
Classes,IniFiles;
type
THashTable = class(THashedStringList)
public
procedure AddStrItem(const ItemName: string;const ItemValue: string);
function ObjectValue(const ObjName: string): TObject;
end;
implementation
{ THashTable }
procedure THashTable.AddStrItem(const ItemName: string;const ItemValue: string);
begin
Add(ItemName+'='+ItemValue);
end;
function THashTable.ObjectValue(const ObjName: string): TObject;
var
AIndex: integer;
begin
Find(ObjName,AIndex);
if AIndex>=0 then
Result := Objects[AIndex];
end;
end.
相关文档:
procedure TForm1.Button2Click(Sender: TObject);
var
name:String ;
begin
name := edit2.Text ;
name := '%' + name ;
query1.Close ;
query1.SQL.Clear ;
query1.SQL.Add('select * from gjh_t where name like '''+name+'''') ;
&nb ......
在低版本中设定MSCOMM控件,是导入MSCOMM组件,然后就可以看见MSCOMM控件的电话的图标了,但是在DELPHI 2005或以上版本中就必须先把此控件创建到包中(BPL)然后导入BPL,那个电话图标就可以看见在工具条上了。我试了多少回才试出来的。 ......
在网上看到很多人都在为Delphi是否支持C++/Java中的静态变量及静态方法的功能而困扰,其实这在Delphi中是很简单的.
静态方法就是使用Class Function. 静态变量则使用单元局部变量来实现. 代码如下:
//=========================================
// StaticVarTestU - 定义了可以计数的类,通过类方法即可访问此类的对象数 ......
第一种:需要引用Windows单元
ShowMessage(IntToStr(GetSystemMetrics(SM_CYSCREEN)-GetSystemMetrics(SM_CYFULLSCREEN)-GetSystemMetrics(SM_CYCAPTION)));
第二种:需要引用Windows单元
function GetSystemTaskBarHeight:Integer;
var
R:TRect;
begin
SystemParametersInfo(SPI_GETWORKAREA,0,@R,0);
Resul ......