Results 1 to 3 of 3

Thread: showing the floppy disk copy dialog

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 1999
    Location
    u.s.a
    Posts
    127
    I have written a proc that copies a file to a floppy disk.
    I know this is a long shot,but is it possible to show the
    disk copy dialog that pops up when you copy from one drive to a nother in windows?
    (the one with the progress bar ...)
    Is there an API for this?
    Thanks.
    Dan.

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    You need to use the SHFileOperation() API, i.e.
    Code:
    Private Type SHFILEOPSTRUCT
            hwnd As Long
            wFunc As Long
            pFrom As String
            pTo As String
            fFlags As Integer
            fAnyOperationsAborted As Long
            hNameMappings As Long
            lpszProgressTitle As String '  only used if FOF_SIMPLEPROGRESS
    End Type
    
    Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
    
    Private Const FOF_ALLOWUNDO = &H40
    Private Const FOF_CONFIRMMOUSE = &H2
    Private Const FOF_FILESONLY = &H80                  '  on *.*, do only files
    Private Const FOF_MULTIDESTFILES = &H1
    Private Const FOF_NOCONFIRMATION = &H10             '  Don't prompt the user.
    Private Const FOF_NOCONFIRMMKDIR = &H200            '  don't confirm making any needed dirs
    Private Const FOF_RENAMEONCOLLISION = &H8
    Private Const FOF_SILENT = &H4                      '  don't create progress/report
    Private Const FOF_SIMPLEPROGRESS = &H100            '  means don't show names of files
    Private Const FOF_WANTMAPPINGHANDLE = &H20          '  Fill in SHFILEOPSTRUCT.hNameMappings
    Private Const FOF_CREATEPROGRESSDLG = &H0&
    
    Private Const FO_COPY = &H2
    Private Const FO_DELETE = &H3
    Private Const FO_MOVE = &H1
    Private Const FO_RENAME = &H4
    
    Private Sub Command1_Click()
        Dim tFILE As SHFILEOPSTRUCT
        
        With tFILE
            .hwnd = hwnd
            .pFrom = "C:\Program Files\Microsoft Visual Studio\VB98\*.*" & vbNullChar
            .pTo = "C:\Testing\" & vbNullChar
            .wFunc = FO_COPY
            .fFlags = FOF_FILESONLY
        End With
        
        Call SHFileOperation(tFILE)
    End Sub

  3. #3
    Guest
    If you want to make your own status dialog, Megatron posted an example on how to do it.

    Here is the thread: http://forums.vb-world.net/showthrea...threadid=23489

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width