uses FileCtrl, ShellAPI;
var OpStruc: SHFileOpStruct; sSourceFileName:=sCurPath+'\CD_Maker\*.*';
sTargetFileName:=sCurPath+'\CDROM';
With OpStruc DO
Begin
Wnd:=0;
wFunc:= FO_COPY;
pFrom:=PChar(sSourceFileName);
pTo:=PChar(sTargetFileName);
//fFlags:= FOF_RENAMEONCOLLISION ;
fFlags:= FOF_NOCONFIRMATION OR FOF_RENAMEONCOLLISION;
fAnyOperationsAborted:= FALSE;
hNameMappings:= Nil;
lpszProgressTitle:= Nil;
End;
boolAssistantCopyOK:=(ShFileOperation(OpStruc)=0);
var OpStruc: SHFileOpStruct; sSourceFileName:=sCurPath+'\CD_Maker\*.*';
sTargetFileName:=sCurPath+'\CDROM';
With OpStruc DO
Begin
Wnd:=0;
wFunc:= FO_COPY;
pFrom:=PChar(sSourceFileName);
pTo:=PChar(sTargetFileName);
//fFlags:= FOF_RENAMEONCOLLISION ;
fFlags:= FOF_NOCONFIRMATION OR FOF_RENAMEONCOLLISION;
fAnyOperationsAborted:= FALSE;
hNameMappings:= Nil;
lpszProgressTitle:= Nil;
End;
boolAssistantCopyOK:=(ShFileOperation(OpStruc)=0);
var T : TSHFileOpStruct;
begin
With T do
Begin
//Wnd:=Fm_Create_Question.Handle ;
Wnd:=Application.Handle;
wFunc:=FO_COPY ;
pFrom:=Pchar(FromDir);
pTo:=pchar(ToDir);
hNameMappings:=nil;
lpszProgressTitle:=nil;
fFlags:=FOF_NOCONFIRMATION;
End;
SHFileOperation(T);
result := true;
end;
parameter.lpProgressInput parameter pointing to a progress object that contains client-supplied progress information. If NULL is passed in the
lpProgress parameter, the progress information is provided by MAPI. The lpProgress parameter is ignored unless the FOLDER_DIALOG flag is set in the ulFlags parameter.ulFlagsInput parameter containing a bitmask of flags used to control how the copy or move operation is accomplished. The following flags can be set:COPY_SUBFOLDERSIndicates that all subfolders are included in the copy operation. This is optional for copy operations and is implied for move operations.FOLDER_DIALOGDisplays a progress-information user interface while the operation proceeds.FOLDER_MOVEIndicates that the folder is to be moved. If this flag is not set, the folder will be copied.MAPI_DECLINE_OKInforms the provider that if it chooses not to implement IMAPIFolder::CopyFolder, that it can immediately return MAPI_E_DECLINE_COPY. MAPI_UNICODEIndicates the passed-in strings are in Unicode format. If the MAPI_UNICODE flag is not set, the strings are in 8-bit format.Return ValuesS_OKThe call succeeded and has returned the expected value or values.MAPI_E_BAD_CHARWIDTHEither the MAPI_UNICODE flag was set and the implementation does not support Unicode, or MAPI_UNICODE was not set and the implementation only supports Unicode.MAPI_E_COLLISIONThe name of the folder being moved is the same as the name of a sub-folder in the destination folder. Folder names must be unique.MAPI_E_DECLINE_COPYIndicates that the provider has chosen not to implement this operation.MAPI_E_FOLDER_CYCLEThe source object directly or indirectly contains the destination object. Significant work might have been performed before this condition was discovered so the source and destination object might be partially modified. MAPI_W_PARTIAL_COMPLETIONThe call succeeded, but not all entries were successfully copied. Use the HR_FAILED macro to test for this warning, but the call should be handled as a successful return.CommentsMessage store providers use the IMAPIFolder::CopyFolder method to copy or move folders from one location to another. The folder being copied or moved is added to the destination folder as a subfolder. Only one folder can be copied or moved at a time.
CopyFolder allows simultaneous renaming and moving of folders and the copying or moving of the subfolders of the affected folder. To copy or move all subfolders nested within the copied or moved folder, the client application passes the COPY_SUBFOLDERS flag in the ulFlags parameter. To allow copy or move operations involving more than one folder to continue even if one or more folders specified for the operation do not exist or have already been moved elsewhere, and thus cannot be copied or moved, a message store provider should attempt to complete the operation as best it can for each folder specified. The provider should stop the operation without completing it only in the case of failures it cannot control, such as running out of memory or disk space, message store corruption, and so on.If CopyFolder successfully completes the copy or move operation for every folder requested by the client application, it returns the value S_OK. If one or more folders cannot be copied or moved, CopyFolder returns the value MAPI_W_PARTIAL_COMPLETION. If CopyFolder returns a different value, such as MAPI_E_NOT_ENOUGH_MEMORY, that indicates the call did not complete, though it might already have copied or moved one or more folders without being able to continue. The calling application cannot proceed on the assumption that an error return implies no work was done.If an entry identifier for a folder that doesn't exist is passed in the lpEntryID parameter, CopyFolder returns MAPI_W_PARTIAL_COMPLETION or MAPI_E_NOT_FOUND, depending on a message store's implementation.