SHFileOperation

by Todd G. Nist

Program source is available for download: w-SHFileOp.p
By calling SHFileOperation, one can leverage the existing dialogs for moving files and providing user feed back as to the status of the process all with just one call. It is a fairly simple demo, where it will ask for a directory to be copied, accepting wild cards, a destination directory, a delete directory file specification and a title for the dialog box. Then by invoking the call to SHFileOperation the standard windows dialog box showing the folders and the flying documents will be displayed, this is making the assumption that the information being copied is large enough to allow the dialog to be created. Also, if the files already exist, it will bring up the standard dialog asking if you wish to over write, the size of the file and the date of the files in question. Finally, if delete files is chosen, it will remove the files from the "delete file spec" and bring up the same general dialogs.
To test just make sure you are coping a large file or directory structure. Once it has completed, choose "copy files" again and you should see all the standard dialogs. Finally, specify a delete file spec and choose "delete files".

API-procedures used in this example are listed here to be included in the search index: 
PROCEDURE SHFileOperationA EXTERNAL "Shell32.dll":
PROCEDURE FormatMessageA   EXTERNAL "kernel32.dll":

Attachments

w-shfileop.p.zip : example


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Not working on Win Server 2008

Hi,

I have been trying to make this work for windows server 2008.
When the application runs the method call it stops and doesn't throw any messages.

It works perfectly for Windows XP.

Any Ideas?

Thanks in advance
David


OE 10.2B05 Linux DB Windows

OE 10.2B05 Linux DB Windows Clients

#1 - this .p was created 2 years before Windows 2008 was released.
#2 - this is win32 API and Windows 2008 is 64-bit