PC Review


Reply
Thread Tools Rate Thread

How can I execute File Operations using the Windows File Transfer Common Dialogs?

 
 
Christian Blackburn
Guest
Posts: n/a
 
      19th Oct 2003
Hi Gang,
I would like to have my program use the built in Move and Copy Dialogs that
are used by Windows Explorer/My Computer.
Thanks in Advance,
Christian Blackburn


 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      19th Oct 2003
* "Christian Blackburn" <Christian_Blackburn@Damn@(E-Mail Removed)> scripsit:
> I would like to have my program use the built in Move and Copy Dialogs that
> are used by Windows Explorer/My Computer.


<http://groups.google.com/groups?q=group%3A*dotnet*+SHFileOperation&ie=UTF-8>

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
 
Reply With Quote
 
Christian Blackburn
Guest
Posts: n/a
 
      20th Oct 2003
Hi Herfried,
Thanks for the examples however I couldn't get my implementation to work.
Have you any experience with this function? Perhaps you can tell what I'm
doing wrong.
Here's my code:
---------------------------
Module Shell_File_Operation

Private Structure FileOperationStructure

Dim hWnd As IntPtr

Dim Operation As FileOperation

Dim strSource As String

Dim strDestination As String

Dim Flags As ShellFlags

Dim Aborted As Boolean

Dim FileNameMappings As Integer

Dim strProgress As String

End Structure

Private Enum FileOperation As Integer

Move = &H1

Copy = &H2

Delete = &H3

Rename = &H4

End Enum

Private Enum ShellFlags As Short

MultipleDestinations = &H1

NoConfirmation = &H10

ConfirmOperation = &H2

SilentOperation = &H4

RenameOnCollision = &H8

UseFileNameMappings = &H20

End Enum

Private Declare Function SHFileOperation Lib "shell32" Alias
"SHFileOperationA" (ByVal FileOp As FileOperationStructure) As Integer

Public Sub ShellFileMove(ByVal strSource, ByVal strDestination)

Dim stcMove As FileOperationStructure

'stcMove.hWnd = objMain.Handle

'stcMove.Aborted = False

stcMove.strSource = strSource

'stcMove.strDestination = FilePath(strDestination) & "\"

stcMove.strDestination = strDestination

stcMove.Operation = FileOperation.Move

'stcMove.strProgress = "Test Progress String..."

stcMove.Flags = ShellFlags.NoConfirmation

SHFileOperation(stcMove)

End Sub

End Module

---------------------------

Thanks in Advance,
Christian Blackburn

"Herfried K. Wagner [MVP]" <hirf-spam-me-(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> * "Christian Blackburn" <Christian_Blackburn@Damn@(E-Mail Removed)>

scripsit:
> > I would like to have my program use the built in Move and Copy Dialogs

that
> > are used by Windows Explorer/My Computer.

>
>

<http://groups.google.com/groups?q=gr...ation&ie=UTF-8
>
>
> --
> Herfried K. Wagner
> MVP · VB Classic, VB.NET
> <http://www.mvps.org/dotnet>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      20th Oct 2003
* "Christian Blackburn" <Christian_Blackburn@Damn@(E-Mail Removed)> scripsit:
> Private Declare Function SHFileOperation Lib "shell32" Alias
> "SHFileOperationA" (ByVal FileOp As FileOperationStructure) As Integer


I don't have enough time now to take a look at the definition of the
structure, but you can try to pass 'FileOp' 'ByRef' and remove the
function alias. Instead, you can declare the function as 'Auto'
('Declare Auto Function...').

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Future of common file dialogs in WPF? Peter Duniho Microsoft C# .NET 0 13th Jul 2009 06:26 PM
Re: Shortcut to using new Vista common file dialogs in a WinForms app? G Himangi Microsoft C# .NET 0 24th Jun 2009 12:11 PM
Customize common file open/save dialogs =?Utf-8?B?TWluaS1Ub29scyBUaW1t?= Microsoft Dot NET Framework Forms 2 2nd Aug 2006 03:53 PM
How do I execute a database transfer (.dtf) request file? =?Utf-8?B?bnZ1bnZtZQ==?= Microsoft Access VBA Modules 0 20th Apr 2005 02:35 PM
Windows Common Dialogs in VBA? Leonard Jonas Microsoft Excel Programming 1 22nd Jul 2003 07:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:11 PM.