Mega Code Archive

 
Categories / Delphi / Files
 

Windowsu kullarak dosya kolyalama islemi

function CopyFiles(const Source,Destination: String): Boolean; var SHFileOpStruct : TSHFileOpStruct; begin if FileExists(Source) then begin FillChar(SHFileOpStruct,SizeOf(TSHFileOpStruct),#0); with SHFileOpStruct do begin Wnd:=Application.Handle; wFunc:=FO_COPY; fFlags:=FOF_ALLOWUNDO; hNameMappings:=nil; pFrom:=PChar(Source+#0+#0); pTo:=PChar(Destination+#0+#0); end; Result := ShFileOperation(SHFileOpStruct) = 0; end else Result := False; end; // Kullanimi: procedure TForm1.Button1Click(Sender: TObject); begin if not CopyFiles('C:\windows\notepad.exe', 'C:\sil\notepad.exe') then showmessage('Kopyalama islemi basarisiz'); end;