| Autor |
Beitrag |
Bronstein
      
Beiträge: 578
Erhaltene Danke: 1
WIN XP
Delphi 6 / Delphi 2006 / Delphi XE
|
Verfasst: Di 03.02.04 14:51
Wie kann ich eine Datei(adressen.txt) verschieben, die ich zum Beispiel auf c:\programme habe und nach c:\windows verschieben möchte. Bitte mit Beispielcode.
Vielleicht habt ihr auh eine Lösung für das andere Problem das ich in diesem Forum gestellt habe: Aus txt lesen bestimmter Daten
www.delphi-forum.de/...14#126114[url][/url]
|
|
MaxiTB
      
Beiträge: 679
Win2000, WinXp, Workbench ;-)
D7 Ent, VS2003 Arch.
|
Verfasst: Di 03.02.04 15:10
| Zitat: | SHFileOperation
Copies, moves, renames, or deletes a file system object.
int SHFileOperation(LPSHFILEOPSTRUCT lpFileOp);
Parameters
lpFileOp
[in] Address of an SHFILEOPSTRUCT structure that contains information this function needs to carry out the specified operation. This parameter must contain a valid value that is not NULL. You are responsibile for validating the value. If you do not validate it, you will experience unexpected results.
Return Values
Returns zero if successful, or nonzero otherwise.
Remarks
You should use fully-qualified pathnames with this function. Using it with relative path-names is not thread-safe.
With two exceptions, you cannot use SHFileOperation to move special folders from a local drive to a remote computer by specifying a network path. The exceptions are the MyDocs and MyPics folders (CSIDL_PERSONAL and CSIDL_MYPICTURES, respectively).
When used to delete a file, SHFileOperation will attempt to place the deleted file in the Recycle Bin. If you wish to delete a file and guarantee that it will not be placed in the Recycle Bin, use DeleteFile.
If a copy callback handler is exposed and registered, SHFileOperation will call it unless you set a flag such as FOF_NOCONFIRMATION in the fFlags member of the structure pointed to by lpFileOp. See ICopyHook::CopyCallback for details on implementing copy callback handlers.
File deletion is recursive unless you set the FOF_NORECURSION flag in lpFileOp.
With Microsoft® Windows 2000® and later, it is possible to connect an HTML file with a folder containing related files such as GIF images or style sheets. If file connection is enabled, when you move or copy the HTML file, all of the files in the folder will be moved or copied as well. Conversely, if you move the folder with the related files, the HTML file is also moved.
The HTML file must have a .htm or .html extension. You create the connection to the related files by placing them in a subfolder of the folder containing the HTML file. The folder must have the name of the HTML file followed by " files". For example, if the HTML file is MyFile.htm, the folder should be named "MyFile files". Any files you place in the "MyFile files" subfolder will be connected to MyFile.htm.
File connection is enabled by default. It can be disabled by adding a REG_DWORD value, NoFileFolderConnection, to the HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer registry key. Setting NoFileFolderConnection to 1 disables file connection. If the value is set to zero or is missing, file connection is enabled.
To move only specified files from a group of connected files, set the FOF_ NO_CONNECTED_ELEMENTS flag in the fFlags member of the structure pointed to by lpFileOp.
Note that the use of a folder with a name like "MyFile files" to define a connection may not be valid for localized versions of Windows NT. The term "files" may need be replaced by the equivalent word in the local language.
Windows 95/98/Me: SHFileOperation is supported by the Microsoft Layer for Unicode. To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.
Requirements
Version 4.00 and later of Shell32.dll
Windows NT/2000: Requires Windows NT 4.0 or later.
Windows 95/98/Me: Requires Windows 95 or later.
Header: Declared in Shellapi.h.
Import Library: Shell32.lib. |
Wenn du im Forum suchst nach diesem Befehl findest du eine Menge !
_________________ Euer Mäxchen
Wer früher stirbt, ist länger tot.
|
|
rokdd
      
Beiträge: 329
Win XP
D6
|
Verfasst: Mo 09.02.04 15:23
hallo,
geht aber auch einfacher:
Delphi-Quelltext 1:
| copyfileto(quellenpfad,neuer pfad:string); |
Dazu brauchst du ber die unit idglobal !
rokdd
|
|
MathiasSimmack
Ehemaliges Mitglied
Erhaltene Danke: 1
|
Verfasst: Mo 09.02.04 18:03
"idglobal" ist eine offizielle Delphi-Unit? Ab welcher Version.
|
|
rokdd
      
Beiträge: 329
Win XP
D6
|
Verfasst: Mo 09.02.04 18:06
Gebe zu dass es etwas sehr einfach war. aber ab delphi 6.0 gibt es sie! aber der Hilfebenötigende hat ja auch keine delphiversion angegeben!
Rokdd
|
|
patrick
      
Beiträge: 1481
WIN2k, WIN XP
D6 Personal, D2005 PE
|
Verfasst: Mo 09.02.04 18:40
D6PE Updatepack 2 hat idglobal auch integriert
_________________ Patrick
im zweifelsfall immer das richtige tun!!!
|
|
|