Programlama yapalım ve Öğrenelim. - Delphi Eğitim185
  Ana Sayfa
  .NET Eğitim Notları
  Visual C# .NET Örnek Kodları
  VisualBasic.NET Örnek Kodları
  J# Örnekleri
  ASP.NET Örnek Kodları
  Delphi Eğitim
  => Delphi Eğitim1
  => Delphi Eğitim2
  => Delphi Eğitim3
  => Delphi Eğitim4
  => Delphi Eğitim5
  => Delphi Eğitim6
  => Delphi Eğitim7
  => Delphi Eğitim8
  => Delphi Eğitim9
  => Delphi Eğitim10
  => Delphi Eğitim11
  => Delphi Eğitim13
  => Delphi Eğitim14
  => Delphi Eğitim15
  => Delphi Eğitim16
  => Delphi Eğitim17
  => Delphi Eğitim18
  => Delphi Eğitim19
  => Delphi Eğitim20
  => Delphi Eğitim21
  => Delphi Eğitim22
  => Delphi Eğitim23
  => Delphi Eğitim24
  => Delphi Eğitim25
  => Delphi Eğitim26
  => Delphi Eğitim27
  => Delphi Eğitim28
  => Delphi Eğitim29
  => Delphi Eğitim30
  => Delphi Eğtim31
  => Delphi Eğitim32
  => Delphi Eğitim33
  => Delphi Eğitim34
  => Delphi Eğitim35
  => Delphi Eğitim36
  => Delphi Eğitim37
  => Delphi Eğitim38
  => Delphi Eğitim39
  => Delphi Eğitim40
  => Delphi Eğitim41
  => Delphi Eğitim42
  => Delphi Eğitim43
  => Delphi Eğitim44
  => Delphi Eğitim45
  => Delphi Eğitim46
  => Delphi Eğitim47
  => Delphi Eğitim48
  => Delphi Eğitim49
  => Delphi Eğitim50
  => Delphi Eğitim51
  => Delphi Eğitim52
  => Delphi Eğitim53
  => Delphi Eğitim54
  => Delphi Eğitim55
  => Delphi Eğitim56
  => Delphi Eğitim57
  => Delphi Eğitim58
  => Delphi Eğitim59
  => Delphi Eğitim60
  => Delphi Eğitim61
  => Delphi Eğitim62
  => Delphi Eğitim63
  => Delphi Eğitim64
  => Delphi Eğitim65
  => Delphi Eğitim66
  => Delphi Eğitim67
  => Delphi Eğitim68
  => Delphi Eğitim69
  => Delphi Eğitim70
  => Delphi Eğitim71
  => Delphi Eğitim72
  => Delphi Eğitim73
  => Delphi Eğitim74
  => Delphi Eğitim75
  => Delphi Eğitim76
  => Delphi Eğitim77
  => Delphi Eğitim78
  => Delphi Eğitim79
  => Delphi Eğitim80
  => Delphi Eğitim81
  => Delphi Eğitim82
  => Delphi Eğitim83
  => Delphi Eğitim84
  => Delphi Eğitim85
  => Delphi Eğitim86
  => Delphi Eğitim87
  => Delphi Eğitim88
  => Delphi Eğitim89
  => Delphi Eğitim90
  => Delphi Eğitim91
  => Delphi Eğitim92
  => Delphi Eğitim93
  => Delphi Eğitim94
  => Delphi Eğitim95
  => Delphi Eğitim96
  => Delphi Eğitim97
  => Delphi Eğitim98
  => Delphi Eğitim99
  => Delphi Eğitim100
  => Delphi Eğitim101
  => Delphi Eğitim102
  => Delphi Eğitim103
  => Delphi Eğitim104
  => Delphi Eğitim105
  => Delphi Eğitim106
  => Delphi Eğitim107
  => Delphi Eğitim108
  => Delphi Eğitim109
  => Delphi Eğitim110
  => Delphi Eğitim111
  => Delphi Eğitim112
  => Delphi Eğitim113
  => Delphi Eğitim114
  => Delphi Eğitim115
  => Delphi Eğitim116
  => Delphi Eğitim117
  => Delphi Eğitim118
  => Delphi Eğitim119
  => Delphi Eğitim120
  => Delphi Eğitim121
  => Delphi Eğitim122
  => Delphi Eğitim123
  => Delphi Eğitim124
  => Delphi Eğitim125
  => Delphi Eğitim126
  => Delphi Eğitim127
  => Delphi Eğitim128
  => Delphi Eğitim129
  => Delphi Eğitim130
  => Delphi Eğitim131
  => Delphi Eğitim132
  => Delphi Eğitim133
  => Delphi Eğitim134
  => Delphi Eğitim135
  => Delphi Eğitim136
  => Delphi Eğitim137
  => Delphi Eğitim138
  => Delphi Eğitim139
  => Delphi Eğitim140
  => Delphi Eğitim141
  => Delphi Eğitim142
  => Delphi Eğitim143
  => Delphi Eğitim144
  => Delphi Eğitim145
  => Delphi Eğitim146
  => Delphi eğitim147
  => Delphi Eğitim148
  => Delphi Eğitim149
  => Delphi Eğitim150
  => Delphi Eğitim151
  => Delphi Eğitim152
  => Delphi Eğitim153
  => Delphi Eğitim154
  => Delphi Eğitim155
  => Delphi Eğitim156
  => Delphi Eğitim157
  => Delphi Eğitim158
  => Delphi Eğitim159
  => Delphi Eğitim160
  => Delphi Eğitim161
  => Delphi Eğitim162
  => Delphi Eğitim164
  => Delphi Eğitim165
  => Delphi Eğitim166
  => Delphi Eğitim167
  => Delphi Eğitim168
  => Delphi Eğitim169
  => Delphi Eğitim170
  => Delphi Eğitim171
  => Delphi Eğitim172
  => Delphi Eğitim173
  => Delphi Eğitim174
  => Delphi Eğitim175
  => Delphi Eğitim176
  => Delphi Eğitim177
  => Delphi Eğitim178
  => Delphi Eğitim179
  => Delphi Eğitim180
  => Delphi Eğitim181
  => Delphi Eğitim182
  => Delphi Eğitim183
  => Delphi Eğitim184
  => Delphi Eğitim185
  => Delphi Eğitim186
  => Delphi Eğitim187
  => Delphi Eğitim188
  => Delphi Eğitim189
  => Delphi Eğitim190
  => Delphi Eğitim191
  => Delphi Eğitim192
  => Delphi Eğitim193
  => Delphi Eğitim194
  => Delphi Eğitim195
  => Delphi Eğitim196
  => Delphi Eğitim197
  => Delphi Eğitim198
  => Delphi Eğitim199
  => Delphi Eğitim200
  => Delphi Eğitim201
  => Delphi Eğitim202
  => Delphi Eğitim203
  => Delphi Eğitim204
  => Delphi Eğitim205
  => Delphi Eğitim206
  => Delphi Eğitim207
  => Delphi Eğitim208
  => Delphi Eğitim209
  => Delphi Eğitim210
  => Delphi Eğitim211
  => Delphi Eğitim212
  => Delphi Eğitim213
  => Delphi Eğitim214
  => Delphi Eğitim215
  => Delphi Eğitim216
  => Delphi Eğitim217
  => Delphi Eğitim218
  => Delphi Eğitim219
  => Delphi Eğitim220
  => Delphi Eğitim221
  => Delphi Eğitim222
  => Delphi Eğitim223
  => Delphi Eğitim224
  => Delphi Eğitim225
  => Delphi Eğitim226
  => Delphi Eğitim227
  => Delphi Eğitim228
  => Delphi Eğitim229
  => Delphi Eğitim230
  => Delphi Eğitim231
  => Delphi Eğitim232
  => Delphi Eğitim233
  => Delphi Eğitim234
  => Delphi Eğitim235
  => Delphi Eğitim236
  => Delphi Eğitim237
  => Delphi Eğitim238
  => Delphi Eğitim239
  => Delphi Eğitim240
  => Delphi Eğitim241
  => Delphi Eğitim242
  İletişim

neoturk: ...Load rft text from a resource file into a trichedit ?...

(*

  Load RTF file from resource:

 

  You can store any kind of file as a RCDATA resource.

  The following example shows this with an RTF file.

 

  Create a text file called textres.rc and put the

  following line in it:

 

  TESTDOC RCDATA "textdoc.rtf"

 

  Next, compile that using the Borland Resource Compiler,

  which is provided with Delphi.

 

  brcc32.exe textres.rc

 

  Your next step is to include the compiled resource (.RES) file into

  your executable, which can be done with the {$R} compiler directive.

 

*)

 

(*

 

  Man kann eine beliebige Datei als RCDATA Ressource in eine

  Exe-Datei einbinden.

  Das folgende Beispiel zeigt, wie man einen RTF-Text aus

  einer Ressource lädt und in einem TRichEdit anzeigt.

 

  Erstelle zuerst eine Datei "textres.rc" mit folgendem Inhalt:

 

  TESTDOC RCDATA "textdoc.rtf"

 

  Kompiliere diese mit brcc32.exe:

 

  brcc32.exe textres.rc

 

  Es wurde nun eine textres.res Datei erzeugt.

 

*)

 

 

implementation

 

{$R *.dfm}

{$R textres.res}  // <---- your resource file!

 

procedure TForm1.Button1Click(Sender: TObject);

var

  rs: TResourceStream;

begin

  rs := TResourceStream.Create(hinstance, 'TESTDOC', RT_RCDATA);

  try

    Richedit1.PlainText := False;

    TempStream.Position := 0;

    Richedit1.Lines.LoadFromStream(rs);

  finally

    rs.Free;

  end;

end;

 

Delphi - .....................................

 

neoturk: ...Set a file's compression state ?...

{

  To set a file's compression state, use the DeviceIoControl function with the

  FSCTL_SET_COMPRESSION operation.

 

  Call the following function with the name of the file to compress and

  boolean parameter 'forceCompress'. If that one is true, file will be compressed.

  If it is false, the file will be compressed only if its parent folder is

  compressed (reason for that parameter: if you MoveFile uncompressed file from

  uncompressed folder to compressed folder, file will not become automatically

  compressed - at least under some NT 4 service packs).

 

  Ein "compressed" Attribut kann man nicht mit der FileSetAttr Funktion setzen

  sondern muss DeviceIoControl Funktion mit dem flag FSCTL_SET_COMPRESSION verwenden:

}

 

 

const

  COMPRESSION_FORMAT_NONE = 0

  COMPRESSION_FORMAT_LZNT1 = 2

  COMPRESSION_FORMAT_DEFAULT = 1;

  FILE_DEVICE_FILE_SYSTEM = 9;

  METHOD_BUFFERED = 0;

  FILE_READ_DATA = 1;

  FILE_WRITE_DATA = 2;

  FSCTL_SET_COMPRESSION = (FILE_DEVICE_FILE_SYSTEM shl 16) or

    ((FILE_READ_DATA or FILE_WRITE_DATA) shl 14) or (16 shl 2) or METHOD_BUFFERED;

 

function SetCompressedAttribut(FileName: PChar; forceCompress: Boolean): Boolean;

var

  hnd: Integer;

  Comp: SHORT;

  res: DWORD;

begin

  if forceCompress or ((GetFileAttributes(PChar(ExtractFilePath(FileName))) and

    FILE_ATTRIBUTE_COMPRESSED) <> 0) then

  begin

    Result := False;

    if (GetFileAttributes(FileName) and FILE_ATTRIBUTE_COMPRESSED) = 0 then

    begin

      hnd := CreateFile(FileName, GENERIC_READ + GENERIC_WRITE, 0, nil, OPEN_EXISTING, 0, 0);

      try

        Comp := COMPRESSION_FORMAT_DEFAULT;

        if not DeviceIoControl(hnd, FSCTL_SET_COMPRESSION, @Comp,

          SizeOf(SHORT), nil, 0, res, nil) then Exit;

      finally

        CloseHandle(hnd);

      end;

    end;

    Result := True;

  end

  else

    Result := True;

end;

 

procedure TForm1.Button1Click(Sender: TObject);

begin

  if OpenDialog1.Execute then

  begin

    SetCompressedAttribut(PChar(OpenDialog1.FileName), True);

  end;

end;

 

Delphi - .....................................

 

neoturk: ...Set a file's compression state ?...

{

  To set a file's compression state, use the DeviceIoControl function with the

  FSCTL_SET_COMPRESSION operation.

 

  Call the following function with the name of the file to compress and

  boolean parameter 'forceCompress'. If that one is true, file will be compressed.

  If it is false, the file will be compressed only if its parent folder is

  compressed (reason for that parameter: if you MoveFile uncompressed file from

  uncompressed folder to compressed folder, file will not become automatically

  compressed - at least under some NT 4 service packs).

 

  Ein "compressed" Attribut kann man nicht mit der FileSetAttr Funktion setzen

  sondern muss DeviceIoControl Funktion mit dem flag FSCTL_SET_COMPRESSION verwenden:

}

 

 

const

  COMPRESSION_FORMAT_NONE = 0

  COMPRESSION_FORMAT_LZNT1 = 2

  COMPRESSION_FORMAT_DEFAULT = 1;

  FILE_DEVICE_FILE_SYSTEM = 9;

  METHOD_BUFFERED = 0;

  FILE_READ_DATA = 1;

  FILE_WRITE_DATA = 2;

  FSCTL_SET_COMPRESSION = (FILE_DEVICE_FILE_SYSTEM shl 16) or

    ((FILE_READ_DATA or FILE_WRITE_DATA) shl 14) or (16 shl 2) or METHOD_BUFFERED;

 

function SetCompressedAttribut(FileName: PChar; forceCompress: Boolean): Boolean;

var

  hnd: Integer;

  Comp: SHORT;

  res: DWORD;

begin

  if forceCompress or ((GetFileAttributes(PChar(ExtractFilePath(FileName))) and

    FILE_ATTRIBUTE_COMPRESSED) <> 0) then

  begin

    Result := False;

    if (GetFileAttributes(FileName) and FILE_ATTRIBUTE_COMPRESSED) = 0 then

    begin

      hnd := CreateFile(FileName, GENERIC_READ + GENERIC_WRITE, 0, nil, OPEN_EXISTING, 0, 0);

      try

        Comp := COMPRESSION_FORMAT_DEFAULT;

        if not DeviceIoControl(hnd, FSCTL_SET_COMPRESSION, @Comp,

          SizeOf(SHORT), nil, 0, res, nil) then Exit;

      finally

        CloseHandle(hnd);

      end;

    end;

    Result := True;

  end

  else

    Result := True;

end;

 

procedure TForm1.Button1Click(Sender: TObject);

begin

  if OpenDialog1.Execute then

  begin

    SetCompressedAttribut(PChar(OpenDialog1.FileName), True);

  end;

end;

 

Delphi - .....................................

 

neoturk: ...Copy a file using a progressbar ?...

{ 1. }

 

{

 You need a TProgressBar on your form for this tip.

 Für diesen Tip wird eine TProgressBar benötigt.

}

 

 

procedure TForm1.CopyFileWithProgressBar1(Source, Destination: string);

var

  FromF, ToF: file of byte;

  Buffer: array[0..4096] of char;

  NumRead: integer;

  FileLength: longint;

begin

  AssignFile(FromF, Source);

  reset(FromF);

  AssignFile(ToF, Destination);

  rewrite(ToF);

  FileLength := FileSize(FromF);

  with Progressbar1 do

  begin

    Min := 0;

    Max := FileLength;

    while FileLength > 0 do

    begin

      BlockRead(FromF, Buffer[0], SizeOf(Buffer), NumRead);

      FileLength := FileLength - NumRead;

      BlockWrite(ToF, Buffer[0], NumRead);

      Position := Position + NumRead;

    end;

    CloseFile(FromF);

    CloseFile(ToF);

  end;

end;

 

 

procedure TForm1.Button1Click(Sender: TObject);

begin

  CopyFileWithProgressBar1('c:WindowsWelcome.exe', 'c:tempWelcome.exe');

end;

 

{ 2. }

 

{***************************************}

 

// To show the estimated time to copy a file:

 

procedure TForm1.CopyFileWithProgressBar1(Source, Destination: string);

var

  FromF, ToF: file of byte;

  Buffer: array[0..4096] of char;

  NumRead: integer;

  FileLength: longint;

  t1, t2: DWORD;

  maxi: integer;

begin

  AssignFile(FromF, Source);

  reset(FromF);

  AssignFile(ToF, Destination);

  rewrite(ToF);

  FileLength := FileSize(FromF);

  with Progressbar1 do

  begin

    Min  := 0;

    Max  := FileLength;

    t1   := TimeGetTime;

    maxi := Max div 4096;

    while FileLength > 0 do

    begin

      BlockRead(FromF, Buffer[0], SizeOf(Buffer), NumRead);

      FileLength := FileLength - NumRead;

      BlockWrite(ToF, Buffer[0], NumRead);

      t2  := TimeGetTime;

      Min := Min + 1;

      // Show the time in Label1

      label1.Caption := FormatFloat('0.00', ((t2 - t1) / min * maxi - t2 + t1) / 100);

      Application.ProcessMessages;

      Position := Position + NumRead;

    end;

    CloseFile(FromF);

    CloseFile(ToF);

  end;

end;

 

{ 3. }

{***************************************}

// To show the estimated time to copy a file, using a callback function:

 

type

  TCallBack = procedure(Position, Size: Longint); { export; }

 

procedure FastFileCopy(const InFileName, OutFileName: string;

  CallBack: TCallBack);

 

 

implementation

 

procedure FastFileCopyCallBack(Position, Size: Longint);

begin

  Form1.ProgressBar1.Max := Size;

  Form1.ProgressBar1.Position := Position;

end;

 

procedure FastFileCopy(const InFileName, OutFileName: string;

  CallBack: TCallBack);

const

  BufSize = 3 * 4 * 4096; { 48Kbytes gives me the best results }

type

  PBuffer = ^TBuffer;

  TBuffer = array[1..BufSize] of Byte;

var

  Size: DWORD;

  Buffer: PBuffer;

  infile, outfile: file;

  SizeDone, SizeFile: LongInt;

begin

  if (InFileName <> OutFileName) then

  begin

    buffer := nil;

    Assign(infile, InFileName);

    Reset(infile, 1);

    try

      SizeFile := FileSize(infile);

      Assign(outfile, OutFileName);

      Rewrite(outfile, 1);

      try

        SizeDone := 0;

        New(Buffer);

        repeat

          BlockRead(infile, Buffer^, BufSize, Size);

          Inc(SizeDone, Size);

          CallBack(SizeDone, SizeFile);

          BlockWrite(outfile, Buffer^, Size)

        until Size < BufSize;

        FileSetDate(TFileRec(outfile).Handle,

        FileGetDate(TFileRec(infile).Handle));

      finally

        if Buffer <> nil then

          Dispose(Buffer);

        CloseFile(outfile)

      end;

    finally

      CloseFile(infile);

    end;

  end

  else

    raise EInOutError.Create('File cannot be copied onto itself')

end; {FastFileCopy}

 

 

 

 

procedure TForm1.Button1Click(Sender: TObject);

begin

  FastFileCopy('c:daten.txt', 'c:testdaten2.txt', @FastFileCopyCallBack);

end;

 

{ 4. }

{***************************************}

 

 

function CopyFileWithProgressBar2(TotalFileSize,

  TotalBytesTransferred,

  StreamSize,

  StreamBytesTransferred: LARGE_INTEGER;

  dwStreamNumber,

  dwCallbackReason: DWORD;

  hSourceFile,

  hDestinationFile: THandle;

  lpData: Pointer): DWORD; stdcall;

begin

  // just set size at the beginning

  if dwCallbackReason = CALLBACK_STREAM_SWITCH then

    TProgressBar(lpData).Max := TotalFileSize.QuadPart;

 

  TProgressBar(lpData).Position := TotalBytesTransferred.QuadPart;

  Application.ProcessMessages;

  Result := PROGRESS_CONTINUE;

end;

 

function TForm1.CopyWithProgress(sSource, sDest: string): Boolean;

begin

  // set this FCancelled to true, if you want to cancel the copy operation

  FCancelled := False;

  Result     := CopyFileEx(PChar(sSource), PChar(sDest), @CopyFileWithProgressBar2,

    ProgressBar1, @FCancelled, 0);

end;

 

end;

 

{***************************************}

 

Delphi - .....................................

 

neoturk: ...Copy a file using a progressbar ?...

{ 1. }

 

{

 You need a TProgressBar on your form for this tip.

 Für diesen Tip wird eine TProgressBar benötigt.

}

 

 

procedure TForm1.CopyFileWithProgressBar1(Source, Destination: string);

var

  FromF, ToF: file of byte;

  Buffer: array[0..4096] of char;

  NumRead: integer;

  FileLength: longint;

begin

  AssignFile(FromF, Source);

  reset(FromF);

  AssignFile(ToF, Destination);

  rewrite(ToF);

  FileLength := FileSize(FromF);

  with Progressbar1 do

  begin

    Min := 0;

    Max := FileLength;

    while FileLength > 0 do

    begin

      BlockRead(FromF, Buffer[0], SizeOf(Buffer), NumRead);

      FileLength := FileLength - NumRead;

      BlockWrite(ToF, Buffer[0], NumRead);

      Position := Position + NumRead;

    end;

    CloseFile(FromF);

    CloseFile(ToF);

  end;

end;

 

 

procedure TForm1.Button1Click(Sender: TObject);

begin

  CopyFileWithProgressBar1('c:WindowsWelcome.exe', 'c:tempWelcome.exe');

end;

 

{ 2. }

 

{***************************************}

 

// To show the estimated time to copy a file:

 

procedure TForm1.CopyFileWithProgressBar1(Source, Destination: string);

var

  FromF, ToF: file of byte;

  Buffer: array[0..4096] of char;

  NumRead: integer;

  FileLength: longint;

  t1, t2: DWORD;

  maxi: integer;

begin

  AssignFile(FromF, Source);

  reset(FromF);

  AssignFile(ToF, Destination);

  rewrite(ToF);

  FileLength := FileSize(FromF);

  with Progressbar1 do

  begin

    Min  := 0;

    Max  := FileLength;

    t1   := TimeGetTime;

    maxi := Max div 4096;

    while FileLength > 0 do

    begin

      BlockRead(FromF, Buffer[0], SizeOf(Buffer), NumRead);

      FileLength := FileLength - NumRead;

      BlockWrite(ToF, Buffer[0], NumRead);

      t2  := TimeGetTime;

      Min := Min + 1;

      // Show the time in Label1

      label1.Caption := FormatFloat('0.00', ((t2 - t1) / min * maxi - t2 + t1) / 100);

      Application.ProcessMessages;

      Position := Position + NumRead;

    end;

    CloseFile(FromF);

    CloseFile(ToF);

  end;

end;

 

{ 3. }

{***************************************}

// To show the estimated time to copy a file, using a callback function:

 

type

  TCallBack = procedure(Position, Size: Longint); { export; }

 

procedure FastFileCopy(const InFileName, OutFileName: string;

  CallBack: TCallBack);

 

 

implementation

 

procedure FastFileCopyCallBack(Position, Size: Longint);

begin

  Form1.ProgressBar1.Max := Size;

  Form1.ProgressBar1.Position := Position;

end;

 

procedure FastFileCopy(const InFileName, OutFileName: string;

  CallBack: TCallBack);

const

  BufSize = 3 * 4 * 4096; { 48Kbytes gives me the best results }

type

  PBuffer = ^TBuffer;

  TBuffer = array[1..BufSize] of Byte;

var

  Size: DWORD;

  Buffer: PBuffer;

  infile, outfile: file;

  SizeDone, SizeFile: LongInt;

begin

  if (InFileName <> OutFileName) then

  begin

    buffer := nil;

    Assign(infile, InFileName);

    Reset(infile, 1);

    try

      SizeFile := FileSize(infile);

      Assign(outfile, OutFileName);

      Rewrite(outfile, 1);

      try

        SizeDone := 0;

        New(Buffer);

        repeat

          BlockRead(infile, Buffer^, BufSize, Size);

          Inc(SizeDone, Size);

          CallBack(SizeDone, SizeFile);

          BlockWrite(outfile, Buffer^, Size)

        until Size < BufSize;

        FileSetDate(TFileRec(outfile).Handle,

        FileGetDate(TFileRec(infile).Handle));

      finally

        if Buffer <> nil then

          Dispose(Buffer);

        CloseFile(outfile)

      end;

    finally

      CloseFile(infile);

    end;

  end

  else

    raise EInOutError.Create('File cannot be copied onto itself')

end; {FastFileCopy}

 

 

 

 

procedure TForm1.Button1Click(Sender: TObject);

begin

  FastFileCopy('c:daten.txt', 'c:testdaten2.txt', @FastFileCopyCallBack);

end;

 

{ 4. }

{***************************************}

 

 

function CopyFileWithProgressBar2(TotalFileSize,

  TotalBytesTransferred,

  StreamSize,

  StreamBytesTransferred: LARGE_INTEGER;

  dwStreamNumber,

  dwCallbackReason: DWORD;

  hSourceFile,

  hDestinationFile: THandle;

  lpData: Pointer): DWORD; stdcall;

begin

  // just set size at the beginning

  if dwCallbackReason = CALLBACK_STREAM_SWITCH then

    TProgressBar(lpData).Max := TotalFileSize.QuadPart;

 

  TProgressBar(lpData).Position := TotalBytesTransferred.QuadPart;

  Application.ProcessMessages;

  Result := PROGRESS_CONTINUE;

end;

 

function TForm1.CopyWithProgress(sSource, sDest: string): Boolean;

begin

  // set this FCancelled to true, if you want to cancel the copy operation

  FCancelled := False;

  Result     := CopyFileEx(PChar(sSource), PChar(sDest), @CopyFileWithProgressBar2,

    ProgressBar1, @FCancelled, 0);

end;

 

end;

 

{***************************************}

 

Bu web sitesi ücretsiz olarak Bedava-Sitem.com ile oluşturulmuştur. Siz de kendi web sitenizi kurmak ister misiniz?
Ücretsiz kaydol