Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¡¶Delphi Ëã·¨ÓëÊý¾Ý½á¹¹¡·: ¹ØÓÚ const

Èç¹û²ÎÊýÔÚº¯ÊýÖв»¿ÉÄÜÐÞ¸Ä, Ò»¶¨ÒªÊ¹Óà const;
²»È», ±àÒëÆ÷¾Í»á:
¼Ù¶¨ÏÈÐÞ¸Ä, ÏÈÒª±¸·Ý; ʹÓÃǰºóÒªÔö¼õÒýÓüÆÊý; »¹ÒªÌ×ÉÏ try finally.
Ö¸¶¨ÁË const ¾Í¿ÉÒÔ±ÜÃâÒÔÉϹý³Ì´Ó¶øÌá¸ßЧÂÊ.
unit
Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class
(TForm)
Button1: TButton;
procedure
Button1Click(Sender: TObject);
end
;
var
Form1: TForm1;
implementation
{$R *.dfm}
//ÅжÏÒ»¸ö×Ö·û´®ÖÐÊý×ֵĸöÊý
function
GetNum1(str: string
): Integer;
var
i: Integer;
begin
Result := 0
;
for
i := 1
to
Length(str) do
if
str[i] in
['0'
..'9'
] then
Inc(Result);
end
;
//ͬÑùµÄº¯ÊýÖ»ÊǸø²ÎÊý¼ÓÉÏ const
function
GetNum2(const
str: string
): Integer;
var
i: Integer;
begin
Result := 0
;
for
i := 1
to
Length(str) do
if
str[i] in
['0'
..'9'
] then
Inc(Result);
end
;
{¶Ô±È²âÊÔ}
procedure
TForm1.Button1Click(Sender: TObject);
var
s: string
;
n: Cardinal;
i: Integer;
begin
s := 'ABC123'
;
n := GetTickCount;
for
i := 0
to
1000000
do
GetNum1(s);
n := GetTickCount - n;
Text := IntToStr(n) + ' - '
;
n := GetTickCount;
for
i := 0
to
1000000
do
GetNum2(s);
n := GetTickCount - n;
Text := Text + IntToStr(n);
end
;
end
.


Ïà¹ØÎĵµ£º

Delphi²¥·ÅGifºÍFlash¶¯»­µÄ·½·¨


ÏÔʾһ¸öGIF¶¯»­
procedure ShowGIF( GIFFileName : String );
var TargetFrameName,PostData,Heads,Flags : OleVariant; URL : widestring; begin TargetFrameName := '';{Ö¸¶¨FrameµÄ¿Õ×Ö·û´®Ê±,ÔòÔÚµ±Ç°FrameÖдò¿ª¶¯»­Îļþ} PostData := false;{²»·¢ËÍÊý¾Ý} Heads := '';{HeaderÐÅϢΪ¿Õ} Flags := 0;{FlagsÉèΪ0} ......

delphiÊý¾Ý¿â´¦Àí


µÚÒ»½Ú BDE¡¢ADO¡¢InterBaseºÍdbExpress
    DelphiÖд¦ÀíÊý¾Ý¿âÖ÷ÒªÓÐÁ½ÖÖ·½·¨£¬Ò²¾ÍÊÇBDE¡¢ADO£¬´ÓDelphi 6.0¿ªÊ¼»¹¼ÓÈëÁËÒ»ÖÖdbExpress·½·¨¡£ ÁíÍ⣬Delphi»¹ÌṩÁËרÃÅ´¦ÀíBorland ¹«Ë¾×Ô¼ºµÄÊý¾Ý¿â²úÆ·InterBase Êý¾Ý¿âµÄרÃŵķ½·¨¡£
    BDE£¨Borland Databas Engine£©£¬ ÊÇDelph ......

DelphiµÚÈý·½¿Ø¼þ°²×°Ð¶ÔØÖ¸ÄÏ


DelphiµÚÈý·½¿Ø¼þ°²×°Ð¶ÔØÖ¸ÄÏ
 
»ù±¾°²×°
1¡¢¶ÔÓÚµ¥¸ö¿Ø¼þ£¬Componet-->install component..-->PAS»òDCUÎļþ-->install;
2¡¢¶ÔÓÚ´ø*.dpkÎļþµÄ¿Ø¼þ°ü£¬File-->Open(ÏÂÀ­Áбí¿òÖÐÑ¡*.dpk)-->install¼´¿É£»
3¡¢¶ÔÓÚ´ø*.bplÎļþµÄ¿Ø¼þ°ü£¬Install Packages-->Add-->bplÎļþÃû¼´¿É£»
4¡¢Èç¹ ......

DelphiÖнØÈ¡ÎļþÃû

DelphiÖнØÈ¡ÎļþÃû²»º¬ºó׺²¿·Ö ÊÕ²Ø
µ±ÎļþÃûº¬ÓÐÖÐÎÄʱ£¬²»ÄÜÖ±½ÓÓÃLeftStr(FileName, Length(FileName - 4))»òÕßÓÃPosÀ´¶¨Î»"."µÄλÖÃÀ´»ñÈ¡¡£ÒòΪÖÐÎÄÒ»¸ö×Ö·ûÏ൱ÓëÁ½¸öÓ¢ÎÄ×Ö·û¡£ÕâÑù½ØÈ¡ÍùÍù»¹ÊǰÑÕû¸öFileName¶¼½ØÏÂÀ´ÁË¡£
Ó¦µ±Ê¹ÓÃCopyº¯Êý£¬ÈçÏ£º
TmpFileLength := Pos(extFile, FileName); TmpFileName := ......

¡¶Delphi Ëã·¨ÓëÊý¾Ý½á¹¹¡·: Êý¾Ý¶ÔÆë

ΪÁ˼ӿìÓ²¼þµÄ·ÃÎÊËÙ¶È, ±àÒëÆ÷ͨ³£ÒªÊ¹ÓÃ"Êý¾Ý¶ÔÆë", Æ©Èç:
//ÏÂÃæ½á¹¹ÖÐ: SizeOf(TRec) = 6; ÒòΪ b ÔÚÕâÀïÒ²ÒªÕ¼ 2 ×Ö½Ú.
TRec = record
a: Word;
b: Byte;
c: Word;
end
;
//ÏÂÃæ½á¹¹ÖÐ: SizeOf(TRec) = 16; ÕâÀïµÄ a ºÍ b ¹²Õ¼ÁË 8 ¸ö×Ö½Ú.
TRec = record
a: Byte;
b: Byte;
c: Do ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ