By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,441 Members | 998 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,441 IT Pros & Developers. It's quick & easy.

reference to shell32.dll

jamesd0142
100+
P: 469
Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.  
  3.     Private Sub CreateZipFile(ByVal Filename As String) 'create a new empty zip file
  4.         Dim Encoder As New System.Text.ASCIIEncoding
  5.         Dim Header As String = "PK" & Chr(5) & Chr(6)
  6.         Header = Header.PadRight(22, Chr(0))
  7.         My.Computer.FileSystem.WriteAllBytes(Filename, Encoder.GetBytes(Header), False)
  8.     End Sub
  9.  
  10.     Private Sub ZipFile(ByVal Input As String, ByVal Filename As String)
  11.         Dim Shell As New Shell32.Shell
  12.         CreateZipFile(Filename)
  13.         Shell.NameSpace(Filename).CopyHere(Input)
  14.     End Sub
  15.  
  16. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  17.         'take everything from the C:\Testfrom directory and compress it into the c:\testzip.zip file
  18.         ZipFile("c:\testfrom", "c:\testzip.zip")
  19.  
  20.     End Sub
  21. End Class
  22.  
The code above allows me to zip a folder. Although i get error with the line "Dim Shell As New Shell32.Shell" {LINE 11}

It says (by the person who wrote the code:
Requires reference to shell32.dll in %windir%\system32

So could anyone help by telling me what i need to do?

Source: http://www.xtremevbtalk.com/showthread.php?t=284538

Thanks
Jan 7 '08 #1
Share this Question
Share on Google+
1 Reply


jamesd0142
100+
P: 469
OK i sorted this now, thanks anyway...
Jan 7 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.