![]() |
Datei kopieren bitte um konkretes beispiel
Bei mir klappts einach nicht mit dem quelltext...
Delphi-Quellcode:
Erster fehler:
unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, shellapi, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} function DoFileWork( aWnd: HWND; aOperation: UINT; aFrom, aTo: TStrings; Flags: FILEOP_FLAGS): Integer; var I: Integer; FromPath, ToPath: string; SHFileOpStruct: TSHFileOpStruct; begin FromPath := ''; for I := 0 to aFrom.Count - 1 do FromPath := FromPath + aFrom.Strings[I] + #0; FromPath := FromPath + #0; if Assigned(aTo) then begin ToPath := ''; for I := 0 to aTo.Count - 1 do ToPath := ToPath + aTo.Strings[I] + #0; ToPath := ToPath + #0; if aTo.Count > 0 then Flags := Flags or FOF_MULTIDESTFILES; end; with SHFileOpStruct do begin Wnd := aWnd; wFunc := aOperation; pFrom := PChar(FromPath); if Assigned(aTo) then begin pTo := PChar(ToPath) end else begin // target available pTo := nil; end; // target not available fFlags := aFlags;//undeclared identifier end; // structure Result := SHFileOperation(SHFileOpStruct); end; procedure TForm1.Button1Click(Sender: TObject); begin DoFileWork(Self.Handle, FO_DELETE, strlFiles, nil, FOF_ALLOWUNDO); end; end. undeclared identifier: 'aflags' Zweiter Fehler: undeclared identifier: 'strlFiles' .... Kann mir bitte jemand einen Code für ein Beispiel geben. Zum Beispiel von C:\text.exe nach c:\projekt\test.exe. Also eine Datei kopieren. Find leider dazu nichts im Forum mfg Werner |
Re: Datei kopieren bitte um konkretes beispiel
Zitat:
Zitat:
Auch wenn du ein Anfänger sein solltest: Delphi explodiert nicht (hoffe ich), wenn du einfach mal was ausprobierst. ;) |
Re: Datei kopieren bitte um konkretes beispiel
Hallo Tzuxy
Schau mal in der deiner Hilfedatei von Delphi rein und such mal nach CopyFile um es auch gleich zu verstehen. hier ein Beispiel
Delphi-Quellcode:
MFG
CopyFile('C:/test.exe','c:/test_copy.exe',True);
Tino |
Re: Datei kopieren bitte um konkretes beispiel
Delphi-Quellcode:
Kopieren mittels löschen? :gruebel:
DoFileWork(Self.Handle, FO_DELETE, strlFiles, nil, FOF_ALLOWUNDO);
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:41 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz