3 Replies - 6856 Views - Last Post: 28 November 2005 - 10:07 AM Rate Topic: -----

#1 Xenon  Icon User is offline

  • Connection failed
  • member icon

Reputation: 8
  • View blog
  • Posts: 1,595
  • Joined: 12-September 05

copying files from a zip folder to specific place

Posted 10 November 2005 - 10:55 PM

hello,

i am trying to make an installer program in VB that would place certain files from a zip folder to the specified location.


alternate method that i might choose in case this cant be done....
simply copy files in a folder to the specified folder.
i know this ^ can be done, i dont know which syntax..

thanks

EDIT:
how do i make the Open Dialog in the common dialouge contro to display ONLy zip files ??

This post has been edited by Xenon: 10 November 2005 - 11:00 PM


Is This A Good Question/Topic? 0
  • +

Replies To: copying files from a zip folder to specific place

#2 harshnanda  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 38
  • Joined: 04-April 05

Re: copying files from a zip folder to specific place

Posted 11 November 2005 - 08:54 AM

i can help with the last bit:

commondialog1.filter = "*.zip"
Was This Post Helpful? 0
  • +
  • -

#3 Xenon  Icon User is offline

  • Connection failed
  • member icon

Reputation: 8
  • View blog
  • Posts: 1,595
  • Joined: 12-September 05

Re: copying files from a zip folder to specific place

Posted 12 November 2005 - 06:33 AM

thanks for that little help :)
Was This Post Helpful? 0
  • +
  • -

#4 Xenon  Icon User is offline

  • Connection failed
  • member icon

Reputation: 8
  • View blog
  • Posts: 1,595
  • Joined: 12-September 05

Re: copying files from a zip folder to specific place

Posted 28 November 2005 - 10:07 AM

hello i founf a way to do it by API stuf.. it wokrs on me, but i need to verify for others as well... could you please verify this code for me ?
thanks

Add the following objects to a new project:

Name Value Description
this is a tabular form.... dont copy this
FO_COPY &H2 Copies a file or folder 
FO_DELETE &H3 Deletes a file or folder 
FO_MOVE &H1 Moves a file or folder 
FO_RENAME &H4 Renames a file or folder 
FOF_ALLOWUNDO &H40 Used with Rename. When used with Delete the files get sent to the Recycle Bin. 
FOF_FILESONLY &H80 Only allows files. 
FOF_NOCONFIRMATION &H10 Does not display the Delete or Overwrite confirmation dialog. 
FOF_SILENT &H4 Does not display the Windows animation while performing the opperation. 
FOF_SIMPLEPROGRESS &H100 Does not display filenames. 
[CODE]
Add the following to a new module:

Public 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 Long ' only used if FOF_SIMPLEPROGRESS, sets dialog title
End Type

Public Const FO_COPY = &H2 ' Copy File/Folder
Public Const FO_DELETE = &H3 ' Delete File/Folder
Public Const FO_MOVE = &H1 ' Move File/Folder
Public Const FO_RENAME = &H4 ' Rename File/Folder
Public Const FOF_ALLOWUNDO = &H40 ' Allow to undo rename, delete ie sends to recycle bin
Public Const FOF_FILESONLY = &H80  ' Only allow files
Public Const FOF_NOCONFIRMATION = &H10  ' No File Delete or Overwrite Confirmation Dialog
Public Const FOF_SILENT = &H4 ' No copy/move dialog
Public Const FOF_SIMPLEPROGRESS = &H100 ' Does not display file names

Public Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" _
                        (lpFileOp As SHFILEOPSTRUCT) As Long

 

This will copy c:\backup to c:\backup2 and will not show filenames: 
[CODE]
Dim op As SHFILEOPSTRUCT
With op
    .wFunc = FO_COPY ' Set function
    .pTo = "C:\backup2" ' Set new path
    .pFrom = "C:\backup" ' Set current path
    .fFlags = FOF_SIMPLEPROGRESS
End With
' Perform operation
SHFileOperation op

Not all functions require all the parameters. When you delete a file you do not need to specify the pTo parameter. This example sends the file c:\temp.txt to the recycle bin: 

Dim op As SHFILEOPSTRUCT
With op
    .wFunc = FO_DELETE ' Set function
    .pFrom = "C:\temp.txt" ' Set File to delete
    .fFlags = FOF_ALLOWUNDO + FOF_NOCONFIRMATION ' Set Flags
End With
' Perform operation
SHFileOperation op



Was This Post Helpful? 0
  • +
  • -

Page 1 of 1