¹ØÓÚ Delphi ÖÐÁ÷µÄʹÓÃ:·Ö¸îÓëºÏ²¢ÎļþµÄº¯Êý
unit
Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class
(TForm)
Button1: TButton;
Button2: TButton;
procedure
Button1Click(Sender: TObject);
procedure
Button2Click(Sender: TObject);
end
;
var
Form1: TForm1;
implementation
{$R *.dfm}
//·Ö¸îÎļþµÄº¯Êý
{²ÎÊý 1 ÊÇÒª·Ö¸îµÄÎļþÃû; ²ÎÊý 2 ÊÇÒª·ç¸ñÎļþµÄ´óС, µ¥Î»ÊÇ KB}
{·Ö¸îºóµÄÎļþÃûÀ©Õ¹ÃûÓÃÐòºÅÌæ»»}
function
SplitFile(const
FileName: string
; Size: Cardinal): Boolean;
var
fStream: TFileStream; {ÔʼÎļþ}
toStream: TMemoryStream; {·ÖÎļþ}
p,i: Integer; {p ¼Ç¼µ±Ç°Ö¸ÕëλÖÃ; i ¼Ç¼ÕâÊǵڼ¸¸ö·ÖµÄÎļþ}
begin
Result := False;
Size := Size * 1024
; {°Ñ´óСµÄµ¥Î»×ª»»Îª×Ö½Ú}
fStream := TFileStream.Create(FileName, fmOpenRead);
p := 0
;
i := 0
;
toStream := TMemoryStream.Create;
while
p < fStream.Size do
begin
toStream.Clear; {Çå¿ÕÉÏ´ÎÊý¾Ý}
fStream.Position := p; {·ÅºÃÖ¸ÕëλÖÃ}
if
fStream.Size-p < Size then
Size := fStream.Size-p; {×îºóÒ»¸öʱ, ÓжàÉÙËã¶àÉÙ}
toStream.Copyfrom(fStream, Size); {¸´ÖÆ}
toStream.SaveToFile(FileName + '.'
+ IntToStr(i)); {±£´æ}
Inc(i);
p := p + Size;
end
;
fStream.Free;
toStream.Free;
Result := True;
end
;
//ºÏ²¢Îļþ, ²ÎÊýÊÇÆäÖÐÒ»¸ö·ÖÎļþÃû
function
MergeFile(const
FileName: string
): Boolean;
var
ms: TMemoryStream; {¶ÁÈ¡·ÖÎļþ}
fs: TFileStream; {ºÏ²¢ºóµÄÎļþ}
path: string
;
i: Integer;
begin
path := ChangeFileExt(FileName,''
); {È¥µôÐòºÅÀ©Õ¹Ãû}
ShowMessage(path);
i := 0
;
ms := TMemoryStream.Create;
fs := TFileStream.Create(path, fmCreate);
while
FileExists(path + '.'
+ IntToStr(i)) do
begin
ms.LoadfromFile(path + '.'
+ IntToStr(i));
fs.Copyfrom(ms, 0
); {TFileStream ²»ÐèÒª SetSize; µ«Èç¹ûÓà TMemoryStream ¾ÍÐèÒª}
Inc(i);
end
;
ms.Free;
fs.Free;
end
;
Ïà¹ØÎĵµ£º
µÚÒ»½Ú BDE¡¢ADO¡¢InterBaseºÍdbExpress
DelphiÖд¦ÀíÊý¾Ý¿âÖ÷ÒªÓÐÁ½ÖÖ·½·¨£¬Ò²¾ÍÊÇBDE¡¢ADO£¬´ÓDelphi 6.0¿ªÊ¼»¹¼ÓÈëÁËÒ»ÖÖdbExpress·½·¨¡£ ÁíÍ⣬Delphi»¹ÌṩÁËרÃÅ´¦ÀíBorland ¹«Ë¾×Ô¼ºµÄÊý¾Ý¿â²úÆ·InterBase Êý¾Ý¿âµÄרÃŵķ½·¨¡£
BDE£¨Borland Databas Engine£©£¬ ÊÇDelph ......
µÚÒ»½Ú BDE¡¢ADO¡¢InterBaseºÍdbExpress
DelphiÖд¦ÀíÊý¾Ý¿âÖ÷ÒªÓÐÁ½ÖÖ·½·¨£¬Ò²¾ÍÊÇBDE¡¢ADO£¬´ÓDelphi 6.0¿ªÊ¼»¹¼ÓÈëÁËÒ»ÖÖdbExpress·½·¨¡£ ÁíÍ⣬Delphi»¹ÌṩÁËרÃÅ´¦ÀíBorland ¹«Ë¾×Ô¼ºµÄÊý¾Ý¿â²úÆ·InterBase Êý¾Ý¿âµÄרÃŵķ½·¨¡£
BDE£¨Borland Databas Engine£©£¬ ÊÇDelph ......
(Ò») ʹÓö¯Ì¬´´½¨µÄ·½·¨
Ê×ÏÈ´´½¨ Excel ¶ÔÏó£¬Ê¹ÓÃComObj:
var ExcelApp: Variant;
ExcelApp := CreateOleObject( 'Excel.Application' );
1) ÏÔʾµ±Ç°´°¿Ú£º
ExcelApp.Visible := True;
2) ¸ü¸Ä Excel ±êÌâÀ¸£º
ExcelApp.Caption := 'Ó¦ÓóÌÐòµ÷Óà Microsoft Excel';
3) Ìí¼Óй¤×÷²¾£º
ExcelApp.WorkBooks.Add ......
¶Á“Delphi2010,DELPHIµÄÏ£Íû?”ÓиÐ
ÔÎÄ£ºhttp://www.gowjq.com/forum-29-1.html
1£© Ê¢´óµÄÖ÷Òª¿ª·¢¹¤¾ßÊÇDelphi, Ïê¼û£º http://act.sdo.com/Delphi/£¬ ÓÎÏ·ÊÇÒ»ÖÖ¸´ÔÓ½»»¥½çÃæµÄ¿ª·¢£¬Delphi¿ÉÒÔʤÈΡ£Í¬Ñù×÷ΪÆóÒµÓ¦ÓõÄÇ°¶Ë£¬ÓÃDELPHI¿ª·¢Ò²ÊǺܺõÄÑ¡Ôñ¡£
2£© Ò ......
ΪÁ˼ӿìÓ²¼þµÄ·ÃÎÊËÙ¶È, ±àÒëÆ÷ͨ³£ÒªÊ¹ÓÃ"Êý¾Ý¶ÔÆë", Æ©Èç:
//ÏÂÃæ½á¹¹ÖÐ: 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 ......