¸ÄÔìDelphiµÄTStringHash³É±È½ÏͨÓõĹþÏ£±í
ÓÐʱºòÎÒÃÇÐèÒª¿ÉÒÔ¸ßËÙ¼ìË÷µÄÁÐ±í£¬×ÔÈ»»áÏëµ½¹þÏ£±í£¬Æ½Ê±ÎÒÃÇ¿ÉÄÜÏëµ½ÓÃIniFilesµ¥ÔªÀïµÄTHashedStringList£¬µ« THashedStringListÿ´ÎÐÂÔöÒ»¸öItemºó¶¼ÐèҪˢÐÂÒ»±é£¬Êý¾Ý¶àÁË¿ÉÄÜ»áÓеãÂý£¬¸Ð¾õ²»Ì«ºÃ£¬¶øTStringHashÔòÖ»ÄÜ´æ IntegerÐ͵Ä(ËäÈ»ÎÒÃÇ¿ÉÒ԰ѱðµÄ¶«Î÷Ç¿ÖÆ×ª³ÉÕûÐÍ´æ½øÈ¥£¬µ«¸Ð¾õ²»Ì«ºÃ)¡£TStringHashÒѾʵÏÖÁ˹þÏ£±íµÄÈ«²¿¹¦ÄÜ£¬ÎÒÃÇÖ»ÐèÒª¸ÄһϠ¾Í¿ÉÒÔΪ×Ô¼ºËùÓÃÁË¡£
ÎÒÖ÷Òª×öÁËÏÂÃæÒ»Ð©Ð޸ģº
1.ΪÄܸüͨÓÃһЩ£¬°Ñ´æ´¢µÄÖµ¸ÄΪPointerÀàÐÍ;
2.ÐÂÔöÁËFindKey·½·¨ÓÃÓÚÅжϱíÖÐÊÇ·ñ´æÔÚij¸öKeyÁË;
3.ÐÂÔöÁËStartEnumºÍEnumValue·½·¨£¬ÓÃÓÚ±éÀúÕû¸ö¹þÏ£±í£¬±ÈÈ磺
var aItem:TIntfItem;
begin
FList.StartEnum;
while FList.EnumValue(Pointer(aItem)) do
begin
if aItem.Lifecycle=ilSys then
aItem.Free;
end;
end;
4.ÐÂÔöÁËOnDeletionʼþ£¬¹¦ÄܺÍTtreeViewµÄOnDeletionÒ»Ñù£¬É¾³ýItemʱ´¥·¢£¬¿ÉÒÔÔÚÕâÀïÊÍ·ÅЩ¶«Î÷£¬±ÈÈ磺
procedure TIntfFactory.OnDeletion(var Value: Pointer);
begin
if assigned(Value) then
begin
TIntfItem(Value).Free;
Value:=nil;
end;
end;
ÏÂÃæÊÇÐ޸ĺóµÄ´úÂ룺
unit HashList;
interface
Type
PPHashItem = ^PHashItem;
PHashItem = ^THashItem;
THashItem = record
Next: PHashItem;
Key: string;
Value: Pointer;
end;
TDeletionEvent=Procedure(var Value:Pointer) of Object;
THashList = class
private
FEnumIndex:Cardinal;
FCurrItem:PHashItem;
Buckets: array of PHashItem;
FOnDeletion: TDeletionEvent;
procedure DoDeletion(var Value:Pointer);
protected
function Find(const Key: string): PPHashItem;
function HashOf(const Key: string): Cardinal; virtual;
public
constructor Create(Size: Cardinal = 256);
destructor Destroy; override;
procedure Add(const Key: string; Value: Pointer);
procedure Clear;
 
Ïà¹ØÎĵµ£º
ÓÅÐãµÄÊý¾Ý¿âÓ¦ÓÃÓ¦µ±³ä·Ö¿¼ÂÇÊý¾Ý¿â·ÃÎʵÄËÙ¶ÈÎÊÌ⡣ͨ³£¿ÉÒÔͨ¹ýÓÅ»¯Êý¾Ý¿â¡¢ÓÅ»¯ ²éѯÓï¾ä¡¢·ÖÒ³²éѯµÈ;¾¶ÊÕµ½Ã÷ÏÔµÄЧ¹û¡£¼´Ê¹ÊÇÕâÑù£¬Ò²²»¿É±ÜÃâµØ»áÔÚ²éѯʱÉÁÏÖÒ»¸ö´øÓÐ SQL·ûºÅµÄɳ©£¬¼´Êó±ê±ä³ÉÁ˲éѯµÈ´ý¡£×î¿ÉÁ¯µÄÊÇÓû§£¬Ëû£¨Ëý£©ÔÚ´ËʱֻÄÜÎÞÄεصȴý¡£Óöµ½¼±ÐÔ×ӵ쬏ɴàÔÚ´Ëʱ³¢ÊÔ WindowsÖÐµÄÆäËüÓ¦ÓóÌÐ ......
ÒÔCaps Lock¼ü¾ÙÀý£¬ÆäËü(VK_NUMLOCK),Ààͬ£º
ÅжÏ״̬£º
·½·¨1
Level: integer;
Level := GetKeyState(VK_CAPITAL);
if Level = 0 then
//ûÁÁ
else
//ÁÁÁË(1)
·½·¨2
KeyState : TKeyBoardState;
GetKeyboardState(KeyState);
if KeySt ......
¸ù¾ÝDelphiÌṩµÄÓÐ¹Ø DLL±àдºÍµ÷ÓõİïÖúÐÅÏ¢£¬Äã¿ÉÒԺܿìÍê³ÉÒ»°ãµÄ DLL±àдºÍµ÷ÓÃµÄ Ó¦ÓóÌÐò¡£±¾ÎĽéÉܵÄÖ÷ÌâÊÇÈçºÎ±àдºÍµ÷ÓÃÄܹ»´«µÝ¸÷ÖÖ²ÎÊý£¨°üÀ¨¶ÔÏóʵÀý£©µÄ DLL¡£ÀýÈ磬 Ö÷½Ð³ÌÐò´«µÝ¸ø DLLÒ»¸öADOConnection ¶ÔÏóʾÀý×÷Ϊ²ÎÊý£¬ DLLÖеĺ¯ÊýºÍ¹ý³Ìµ÷ÓÃͨ¹ý¸Ã¶ÔÏó ʵÀý·ÃÎÊÊý¾Ý¿â¡£
ÐèÒªÃ÷ȷһЩ»ù±¾¸ÅÄî¡£¶ÔÓ ......
uses ShellAPI;
procedure TForm1.Button1Click(Sender: TObject);
begin
//ÓÃIE´ò¿ª
ShellExecute(Handle, 'open', 'IExplore.EXE', 'about:blank', nil, SW_SHOWNORMAL);
//Óûðºü´ò¿ª
ShellExecute(Handle, 'open', 'firefox.exe', 'about:blank', nil, SW_SHOWNORMAL);
//ÓÃĬÈÏä¯ÀÀÆ÷´ò¿ª
&nbs ......
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
Button2: TButton;
procedure Butt ......