X
-
Originally posted by Mannish Bhandari View Postpretty good program
This program can zip a folder of files successfully but how do I programmatically unzip the resultant "zipped" file ?
Leave a comment:
-
pretty good program
This program can zip a folder of files successfully but how do I programmatically unzip the resultant "zipped" file ?
Leave a comment:
-
As I mentioned in another post, the code is using the shell interface which can be setup to copy a single file just as easy as multiple files. (the linked post has the code setup for a single file)
http://www.powerbasic.com/support/pb...ad.php?t=50266
Leave a comment:
-
Here is the Windows Shell include file. Save as WinShell.INC
NOTE: you can create this using your PB COM browser that came with PB9. (SHELL32 lib)
Code:' Generated by: PowerBASIC COM Browser v.2.00.0058 ' DateTime : 9/3/2008 at 7:48 PM ' ------------------------------------------------ ' Library Name: Shell32 ' Library File: C:\WINDOWS\system32\SHELL32.dll ' Description : Microsoft Shell Controls And Automation ' GUID : {50A7E9B0-70EF-11D1-B75A-00A0C90564FE} ' LCID : 0 ' Version : 1.0 ' Version Dependant ProgID's $PROGID_Shell32_ShellFolderViewOC1 = "Shell.FolderView.1" $PROGID_Shell32_Shell1 = "Shell.Application.1" ' Version Independant ProgID's $PROGID_Shell32_ShellFolderViewOC = "Shell.FolderView" $PROGID_Shell32_Shell = "Shell.Application" ' Class Indentifiers $CLSID_Shell32_ShellFolderViewOC = GUID$("{9BA05971-F6A8-11CF-A442-00A0C90A8F39}") $CLSID_Shell32_Event_DShellFolderViewEvents = GUID$("{98902208-269E-4518-AA56-325D7488F20D}") $CLSID_Shell32_ShellFolderItem = GUID$("{2FE352EA-FD1F-11D2-B1F4-00C04F8EEB3E}") $CLSID_Shell32_ShellLinkObject = GUID$("{11219420-1768-11D1-95BE-00609797EA4F}") $CLSID_Shell32_ShellFolderView = GUID$("{62112AA1-EBE4-11CF-A5FB-0020AFE7292D}") $CLSID_Shell32_Shell = GUID$("{13709620-C279-11CE-A49E-444553540000}") $CLSID_Shell32_ShellDispatchInproc = GUID$("{0A89A860-D7B1-11CE-8350-444553540000}") $CLSID_Shell32_WebViewFolderContents = GUID$("{1820FED0-473E-11D0-A96C-00C04FD705A2}") $CLSID_Shell32_SearchCommand = GUID$("{B005E690-678D-11D1-B758-00A0C90564FE}") $CLSID_Shell32_Event_DSearchCommandEvents = GUID$("{BF273C84-D95B-4AEA-9D91-EB63DCD0073F}") $CLSID_Shell32_FileSearchBand = GUID$("{C4EE31F3-4768-11D2-BE5C-00A0C9A83DA1}") $CLSID_Shell32_PassportClientServices = GUID$("{2D2307C8-7DB4-40D6-9100-D52AF4F97A5B}") ' Interface Indentifiers $IID_Shell32_IFolderViewOC = GUID$("{9BA05970-F6A8-11CF-A442-00A0C90A8F39}") $IID_Shell32_DShellFolderViewEvents = GUID$("{62112AA2-EBE4-11CF-A5FB-0020AFE7292D}") $IID_Shell32_DFConstraint = GUID$("{4A3DF050-23BD-11D2-939F-00A0C91EEDBA}") $IID_Shell32_ISearchCommandExt = GUID$("{1D2EFD50-75CE-11D1-B75A-00A0C90564FE}") $IID_Shell32_FolderItem = GUID$("{FAC32C80-CBE4-11CE-8350-444553540000}") $IID_Shell32_FolderItemVerbs = GUID$("{1F8352C0-50B0-11CF-960C-0080C7F4EE85}") $IID_Shell32_FolderItemVerb = GUID$("{08EC3E00-50B0-11CF-960C-0080C7F4EE85}") $IID_Shell32_FolderItems = GUID$("{744129E0-CBE5-11CE-8350-444553540000}") $IID_Shell32_Folder = GUID$("{BBCBDE60-C3FF-11CE-8350-444553540000}") $IID_Shell32_Folder2 = GUID$("{F0D2D8EF-3890-11D2-BF8B-00C04FB93661}") $IID_Shell32_Folder3 = GUID$("{A7AE5F64-C4D7-4D7F-9307-4D24EE54B841}") $IID_Shell32_FolderItem2 = GUID$("{EDC817AA-92B8-11D1-B075-00C04FC33AA5}") $IID_Shell32_FolderItems2 = GUID$("{C94F0AD0-F363-11D2-A327-00C04F8EEC7F}") $IID_Shell32_FolderItems3 = GUID$("{EAA7C309-BBEC-49D5-821D-64D966CB667F}") $IID_Shell32_IShellLinkDual = GUID$("{88A05C00-F000-11CE-8350-444553540000}") $IID_Shell32_IShellLinkDual2 = GUID$("{317EE249-F12E-11D2-B1E4-00C04F8EEB3E}") $IID_Shell32_IShellFolderViewDual = GUID$("{E7A1AF80-4D96-11CF-960C-0080C7F4EE85}") $IID_Shell32_IShellFolderViewDual2 = GUID$("{31C147B6-0ADE-4A3C-B514-DDF932EF6D17}") $IID_Shell32_IShellDispatch = GUID$("{D8F015C0-C278-11CE-A49E-444553540000}") $IID_Shell32_IShellDispatch2 = GUID$("{A4C6892C-3BA9-11D2-9DEA-00C04FB16162}") $IID_Shell32_IShellDispatch3 = GUID$("{177160CA-BB5A-411C-841D-BD38FACDEAA0}") $IID_Shell32_IShellDispatch4 = GUID$("{EFD84B2D-4BCF-4298-BE25-EB542A59FBDA}") $IID_Shell32_DSearchCommandEvents = GUID$("{60890160-69F0-11D1-B758-00A0C90564FE}") $IID_Shell32_IFileSearchBand = GUID$("{2D91EEA1-9932-11D2-BE86-00A0C9A83DA1}") $IID_Shell32_IWebWizardHost = GUID$("{18BCC359-4990-4BFB-B951-3C83702BE5F9}") $IID_Shell32_INewWDEvents = GUID$("{0751C551-7568-41C9-8E5B-E22E38919236}") $IID_Shell32_IPassportClientServices = GUID$("{B30F7305-5967-45D1-B7BC-D6EB7163D770}") ' SearchCommandExecuteErrors enumeration %SCEE_PATHNOTFOUND = 1 %SCEE_MAXFILESFOUND = 2 %SCEE_INDEXSEARCH = 3 %SCEE_CONSTRAINT = 4 %SCEE_SCOPEMISMATCH = 5 %SCEE_CASESENINDEX = 6 %SCEE_INDEXNOTCOMPLETE = 7 ' OfflineFolderStatus enumeration %OFS_INACTIVE = -1 %OFS_ONLINE = 0 %OFS_OFFLINE = 1 %OFS_SERVERBACK = 2 %OFS_DIRTYCACHE = 3 ' ShellFolderViewOptions enumeration %SFVVO_SHOWALLOBJECTS = 1 %SFVVO_SHOWEXTENSIONS = 2 %SFVVO_SHOWCOMPCOLOR = 8 %SFVVO_SHOWSYSFILES = 32 %SFVVO_WIN95CLASSIC = 64 %SFVVO_DOUBLECLICKINWEBVIEW = 128 %SFVVO_DESKTOPHTML = 512 ' ShellSpecialFolderConstants enumeration %ssfDESKTOP = 0 %ssfPROGRAMS = 2 %ssfCONTROLS = 3 %ssfPRINTERS = 4 %ssfPERSONAL = 5 %ssfFAVORITES = 6 %ssfSTARTUP = 7 %ssfRECENT = 8 %ssfSENDTO = 9 %ssfBITBUCKET = 10 %ssfSTARTMENU = 11 %ssfDESKTOPDIRECTORY = 16 %ssfDRIVES = 17 %ssfNETWORK = 18 %ssfNETHOOD = 19 %ssfFONTS = 20 %ssfTEMPLATES = 21 %ssfCOMMONSTARTMENU = 22 %ssfCOMMONPROGRAMS = 23 %ssfCOMMONSTARTUP = 24 %ssfCOMMONDESKTOPDIR = 25 %ssfAPPDATA = 26 %ssfPRINTHOOD = 27 %ssfLOCALAPPDATA = 28 %ssfALTSTARTUP = 29 %ssfCOMMONALTSTARTUP = 30 %ssfCOMMONFAVORITES = 31 %ssfINTERNETCACHE = 32 %ssfCOOKIES = 33 %ssfHISTORY = 34 %ssfCOMMONAPPDATA = 35 %ssfWINDOWS = 36 %ssfSYSTEM = 37 %ssfPROGRAMFILES = 38 %ssfMYPICTURES = 39 %ssfPROFILE = 40 %ssfSYSTEMx86 = 41 %ssfPROGRAMFILESx86 = 48 ' Interface Name : IFolderViewOC ' Description : Folder View Events Forwarder Object ' ClassID : $CLSID_Shell32_ShellFolderViewOC ' ProgID : $PROGID_Shell32_ShellFolderViewOC ' Version ProgID : $PROGID_Shell32_ShellFolderViewOC1 Interface IFolderViewOC $IID_Shell32_IFolderViewOC Inherit IDispatch Method SetFolderView <1610743808> (Byval pdisp As IDispatch) End Interface ' Interface Name : DShellFolderViewEvents ' Description : Event interface for ShellFolderView ' ClassID : $CLSID_Shell32_Event_DShellFolderViewEvents ' ProgID : $PROGID_Shell32_ShellFolderViewOC ' Version ProgID : $PROGID_Shell32_ShellFolderViewOC1 Class Class_DShellFolderViewEvents $CLSID_Shell32_Event_DShellFolderViewEvents As Event Interface DShellFolderViewEvents $IID_Shell32_DShellFolderViewEvents Inherit IDispatch Method SelectionChanged <200> () ' Insert your code here End Method Method EnumDone <201> () ' Insert your code here End Method Method VerbInvoked <202> () ' Insert your code here End Method Method DefaultVerbInvoked <203> () ' Insert your code here End Method Method BeginDrag <204> () ' Insert your code here End Method End Interface End Class ' Interface Name : DFConstraint ' Description : Constraint used in search command Interface DFConstraint $IID_Shell32_DFConstraint Inherit IDispatch Property Get Name <1610743808> () As String Property Get Value <1610743809> () As Variant End Interface ' Interface Name : ISearchCommandExt ' Description : DocFind automation interface Interface ISearchCommandExt $IID_Shell32_ISearchCommandExt Inherit IDispatch Method ClearResults <1> () Method NavigateToSearchResults <2> () Property Get ProgressText <3> () As String Method SaveSearch <4> () Method GetErrorInfo <5> (ByRef pbs As String) As Long Method SearchFor <6> (Byval iFor As Long) Method GetScopeInfo <7> (Byval bsScope As String, ByRef pdwScopeInfo As Long) Method RestoreSavedSearch <8> (ByRef In pvarFile As Variant) Method Execute <100> (Opt ByRef In RecordsAffected As Variant, Opt ByRef In Parameters As Variant, Opt Byval Options As _ Long) Method AddConstraint <101> (Byval PB_Name As String, Byval Value As Variant) Method GetNextConstraint <102> (Byval fReset As Integer) As DFConstraint End Interface ' Interface Name : FolderItem ' Description : Definition of interface FolderItem Interface FolderItem $IID_Shell32_FolderItem Inherit IDispatch Property Get Application <1610743808> () As IDispatch Property Get Parent <1610743809> () As IDispatch Property Get Name <0> () As String Property Set Name <0> (ByVal pbs As String) Property Get Path <1610743812> () As String Property Get GetLink <1610743813> () As IDispatch Property Get GetFolder <1610743814> () As IDispatch Property Get IsLink <1610743815> () As Integer Property Get IsFolder <1610743816> () As Integer Property Get IsFileSystem <1610743817> () As Integer Property Get IsBrowsable <1610743818> () As Integer Property Get ModifyDate <1610743819> () As Double Property Set ModifyDate <1610743819> (ByVal pdt As Double) Property Get Size <1610743821> () As Long Property Get Type <1610743822> () As String Method Verbs <1610743823> () As FolderItemVerbs Method InvokeVerb <1610743824> (Opt Byval vVerb As Variant) End Interface ' Interface Name : FolderItemVerbs ' Description : Definition of interface FolderItemVerbs Interface FolderItemVerbs $IID_Shell32_FolderItemVerbs Inherit IDispatch Property Get Count <1610743808> () As Long Property Get Application <1610743809> () As IDispatch Property Get Parent <1610743810> () As IDispatch Method Item <1610743811> (Opt Byval index As Variant) As FolderItemVerb Method Meth__NewEnum <-4> () As IUnknown End Interface ' Interface Name : FolderItemVerb ' Description : Definition of interface FolderItemVerb Interface FolderItemVerb $IID_Shell32_FolderItemVerb Inherit IDispatch Property Get Application <1610743808> () As IDispatch Property Get Parent <1610743809> () As IDispatch Property Get Name <0> () As String Method DoIt <1610743811> () End Interface ' Interface Name : FolderItems ' Description : Definition of interface FolderItems Interface FolderItems $IID_Shell32_FolderItems Inherit IDispatch Property Get Count <1610743808> () As Long Property Get Application <1610743809> () As IDispatch Property Get Parent <1610743810> () As IDispatch Method Item <1610743811> (Opt Byval index As Variant) As FolderItem Method Meth__NewEnum <-4> () As IUnknown End Interface ' Interface Name : Folder ' Description : Definition of interface Folder Interface Folder $IID_Shell32_Folder Inherit IDispatch Property Get Title <0> () As String Property Get Application <1610743809> () As IDispatch Property Get Parent <1610743810> () As IDispatch Property Get ParentFolder <1610743811> () As Folder Method Items <1610743812> () As FolderItems Method ParseName <1610743813> (Byval bName As String) As FolderItem Method NewFolder <1610743814> (Byval bName As String, Opt Byval vOptions As Variant) Method MoveHere <1610743815> (Byval vItem As Variant, Opt Byval vOptions As Variant) Method CopyHere <1610743816> (Byval vItem As Variant, Opt Byval vOptions As Variant) Method GetDetailsOf <1610743817> (Byval vItem As Variant, Byval iColumn As Long) As String End Interface ' Interface Name : Folder2 ' Description : Definition of interface Folder2 Interface Folder2 $IID_Shell32_Folder2 Inherit IDispatch Property Get Title <0> () As String Property Get Application <1610743809> () As IDispatch Property Get Parent <1610743810> () As IDispatch Property Get ParentFolder <1610743811> () As Folder Method Items <1610743812> () As FolderItems Method ParseName <1610743813> (Byval bName As String) As FolderItem Method NewFolder <1610743814> (Byval bName As String, Opt Byval vOptions As Variant) Method MoveHere <1610743815> (Byval vItem As Variant, Opt Byval vOptions As Variant) Method CopyHere <1610743816> (Byval vItem As Variant, Opt Byval vOptions As Variant) Method GetDetailsOf <1610743817> (Byval vItem As Variant, Byval iColumn As Long) As String Property Get Self <1610809344> () As FolderItem Property Get OfflineStatus <1610809345> () As Long Method Synchronize <1610809346> () Property Get HaveToShowWebViewBarricade <1> () As Integer Method DismissedWebViewBarricade <1610809348> () End Interface ' Interface Name : Folder3 ' Description : Definition of interface Folder version 3 Interface Folder3 $IID_Shell32_Folder3 Inherit IDispatch Property Get Title <0> () As String Property Get Application <1610743809> () As IDispatch Property Get Parent <1610743810> () As IDispatch Property Get ParentFolder <1610743811> () As Folder Method Items <1610743812> () As FolderItems Method ParseName <1610743813> (Byval bName As String) As FolderItem Method NewFolder <1610743814> (Byval bName As String, Opt Byval vOptions As Variant) Method MoveHere <1610743815> (Byval vItem As Variant, Opt Byval vOptions As Variant) Method CopyHere <1610743816> (Byval vItem As Variant, Opt Byval vOptions As Variant) Method GetDetailsOf <1610743817> (Byval vItem As Variant, Byval iColumn As Long) As String Property Get Self <1610809344> () As FolderItem Property Get OfflineStatus <1610809345> () As Long Method Synchronize <1610809346> () Property Get HaveToShowWebViewBarricade <1> () As Integer Method DismissedWebViewBarricade <1610809348> () Property Get ShowWebViewBarricade <2> () As Integer Property Set ShowWebViewBarricade <2> (ByVal pbShowWebViewBarricade As Integer) End Interface ' Interface Name : FolderItem2 ' Description : Definition of interface FolderItem Version 2 ' ClassID : $CLSID_Shell32_ShellFolderItem Interface FolderItem2 $IID_Shell32_FolderItem2 Inherit IDispatch Property Get Application <1610743808> () As IDispatch Property Get Parent <1610743809> () As IDispatch Property Get Name <0> () As String Property Set Name <0> (ByVal Rhs As String) Property Get Path <1610743812> () As String Property Get GetLink <1610743813> () As IDispatch Property Get GetFolder <1610743814> () As IDispatch Property Get IsLink <1610743815> () As Integer Property Get IsFolder <1610743816> () As Integer Property Get IsFileSystem <1610743817> () As Integer Property Get IsBrowsable <1610743818> () As Integer Property Get ModifyDate <1610743819> () As Double Property Set ModifyDate <1610743819> (ByVal Rhs As Double) Property Get Size <1610743821> () As Long Property Get Type <1610743822> () As String Method Verbs <1610743823> () As FolderItemVerbs Method InvokeVerb <1610743824> (Opt Byval vVerb As Variant) Method InvokeVerbEx <1610809344> (Opt Byval vVerb As Variant, Opt Byval vArgs As Variant) Method ExtendedProperty <1610809345> (Byval bstrPropName As String) As Variant End Interface ' Interface Name : FolderItems2 ' Description : Definition of interface FolderItems Version 2 Interface FolderItems2 $IID_Shell32_FolderItems2 Inherit IDispatch Property Get Count <1610743808> () As Long Property Get Application <1610743809> () As IDispatch Property Get Parent <1610743810> () As IDispatch Method Item <1610743811> (Opt Byval index As Variant) As FolderItem Method Meth__NewEnum <-4> () As IUnknown Method InvokeVerbEx <1610809344> (Opt Byval vVerb As Variant, Opt Byval vArgs As Variant) End Interface ' Interface Name : FolderItems3 ' Description : Definition of interface FolderItems Version 3 Interface FolderItems3 $IID_Shell32_FolderItems3 Inherit IDispatch Property Get Count <1610743808> () As Long Property Get Application <1610743809> () As IDispatch Property Get Parent <1610743810> () As IDispatch Method Item <1610743811> (Opt Byval index As Variant) As FolderItem Method Meth__NewEnum <-4> () As IUnknown Method InvokeVerbEx <1610809344> (Opt Byval vVerb As Variant, Opt Byval vArgs As Variant) Method Filter <1610874880> (Byval grfFlags As Long, Byval bstrFileSpec As String) Property Get Verbs <0> () As FolderItemVerbs End Interface ' Interface Name : IShellLinkDual ' Description : Definition of Shell Link IDispatch interface ' ClassID : $CLSID_Shell32_ShellLinkObject Interface IShellLinkDual $IID_Shell32_IShellLinkDual Inherit IDispatch Property Get Path <1610743808> () As String Property Set Path <1610743808> (ByVal pbs As String) Property Get Description <1610743810> () As String Property Set Description <1610743810> (ByVal pbs As String) Property Get WorkingDirectory <1610743812> () As String Property Set WorkingDirectory <1610743812> (ByVal pbs As String) Property Get Arguments <1610743814> () As String Property Set Arguments <1610743814> (ByVal pbs As String) Property Get Hotkey <1610743816> () As Long Property Set Hotkey <1610743816> (ByVal piHK As Long) Property Get ShowCommand <1610743818> () As Long Property Set ShowCommand <1610743818> (ByVal piShowCommand As Long) Method Resolve <1610743820> (Byval fFlags As Long) Method GetIconLocation <1610743821> (ByRef pbs As String) As Long Method SetIconLocation <1610743822> (Byval bs As String, Byval iIcon As Long) Method Save <1610743823> (Opt Byval vWhere As Variant) End Interface ' Interface Name : IShellLinkDual2 ' Description : Shell Link2 IDispatch interface Interface IShellLinkDual2 $IID_Shell32_IShellLinkDual2 Inherit IDispatch Property Get Path <1610743808> () As String Property Set Path <1610743808> (ByVal Rhs As String) Property Get Description <1610743810> () As String Property Set Description <1610743810> (ByVal Rhs As String) Property Get WorkingDirectory <1610743812> () As String Property Set WorkingDirectory <1610743812> (ByVal Rhs As String) Property Get Arguments <1610743814> () As String Property Set Arguments <1610743814> (ByVal Rhs As String) Property Get Hotkey <1610743816> () As Long Property Set Hotkey <1610743816> (ByVal Rhs As Long) Property Get ShowCommand <1610743818> () As Long Property Set ShowCommand <1610743818> (ByVal Rhs As Long) Method Resolve <1610743820> (Byval fFlags As Long) Method GetIconLocation <1610743821> (ByRef pbs As String) As Long Method SetIconLocation <1610743822> (Byval bs As String, Byval iIcon As Long) Method Save <1610743823> (Opt Byval vWhere As Variant) Property Get Target <1610809344> () As FolderItem End Interface ' Interface Name : IShellFolderViewDual ' Description : definition of interface IShellFolderViewDual ' ClassID : $CLSID_Shell32_WebViewFolderContents Interface IShellFolderViewDual $IID_Shell32_IShellFolderViewDual Inherit IDispatch Property Get Application <1610743808> () As IDispatch Property Get Parent <1610743809> () As IDispatch Property Get Folder <1610743810> () As Folder Method SelectedItems <1610743811> () As FolderItems Property Get FocusedItem <1610743812> () As FolderItem Method SelectItem <1610743813> (ByRef In pvfi As Variant, Byval dwFlags As Long) Method PopupItemMenu <1610743814> (Byval pfi As FolderItem, Opt Byval vx As Variant, Opt Byval vy As Variant) As String Property Get Script <1610743815> () As IDispatch Property Get ViewOptions <1610743816> () As Long End Interface ' Interface Name : IShellFolderViewDual2 ' Description : definition of interface IShellFolderViewDual2 ' ClassID : $CLSID_Shell32_ShellFolderView Interface IShellFolderViewDual2 $IID_Shell32_IShellFolderViewDual2 Inherit IDispatch Property Get Application <1610743808> () As IDispatch Property Get Parent <1610743809> () As IDispatch Property Get Folder <1610743810> () As Folder Method SelectedItems <1610743811> () As FolderItems Property Get FocusedItem <1610743812> () As FolderItem Method SelectItem <1610743813> (ByRef In pvfi As Variant, Byval dwFlags As Long) Method PopupItemMenu <1610743814> (Byval pfi As FolderItem, Opt Byval vx As Variant, Opt Byval vy As Variant) As String Property Get Script <1610743815> () As IDispatch Property Get ViewOptions <1610743816> () As Long Property Get CurrentViewMode <1610809344> () As DWord Property Set CurrentViewMode <1610809344> (ByVal pViewMode As DWord) Method SelectItemRelative <1610809346> (Byval iRelative As Long) End Interface ' Interface Name : IShellDispatch ' Description : Definition of interface IShellDispatch ' ClassID : $CLSID_Shell32_Shell ' ProgID : $PROGID_Shell32_Shell ' Version ProgID : $PROGID_Shell32_Shell1 Interface IShellDispatch $IID_Shell32_IShellDispatch Inherit IDispatch Property Get Application <1610743808> () As IDispatch Property Get Parent <1610743809> () As IDispatch Method NameSpace <1610743810> (Byval vDir As Variant) As Folder Method BrowseForFolder <1610743811> (Byval Hwnd As Long, Byval Title As String, Byval Options As Long, Opt Byval _ RootFolder As Variant) As Folder Method Windows <1610743812> () As IDispatch Method Open <1610743813> (Byval vDir As Variant) Method Explore <1610743814> (Byval vDir As Variant) Method MinimizeAll <1610743815> () Method UndoMinimizeALL <1610743816> () Method FileRun <1610743817> () Method CascadeWindows <1610743818> () Method TileVertically <1610743819> () Method TileHorizontally <1610743820> () Method ShutdownWindows <1610743821> () Method Suspend <1610743822> () Method EjectPC <1610743823> () Method SetTime <1610743824> () Method TrayProperties <1610743825> () Method Help <1610743826> () Method FindFiles <1610743827> () Method FindComputer <1610743828> () Method RefreshMenu <1610743829> () Method ControlPanelItem <1610743830> (Byval szDir As String) End Interface ' Interface Name : IShellDispatch2 ' Description : Updated IShellDispatch Interface IShellDispatch2 $IID_Shell32_IShellDispatch2 Inherit IDispatch Property Get Application <1610743808> () As IDispatch Property Get Parent <1610743809> () As IDispatch Method NameSpace <1610743810> (Byval vDir As Variant) As Folder Method BrowseForFolder <1610743811> (Byval Hwnd As Long, Byval Title As String, Byval Options As Long, Opt Byval _ RootFolder As Variant) As Folder Method Windows <1610743812> () As IDispatch Method Open <1610743813> (Byval vDir As Variant) Method Explore <1610743814> (Byval vDir As Variant) Method MinimizeAll <1610743815> () Method UndoMinimizeALL <1610743816> () Method FileRun <1610743817> () Method CascadeWindows <1610743818> () Method TileVertically <1610743819> () Method TileHorizontally <1610743820> () Method ShutdownWindows <1610743821> () Method Suspend <1610743822> () Method EjectPC <1610743823> () Method SetTime <1610743824> () Method TrayProperties <1610743825> () Method Help <1610743826> () Method FindFiles <1610743827> () Method FindComputer <1610743828> () Method RefreshMenu <1610743829> () Method ControlPanelItem <1610743830> (Byval szDir As String) Method IsRestricted <1610809344> (Byval Group As String, Byval Restriction As String) As Long Method ShellExecute <1610809345> (Byval File As String, Opt Byval vArgs As Variant, Opt Byval vDir As Variant, Opt Byval _ vOperation As Variant, Opt Byval vShow As Variant) Method FindPrinter <1610809346> (Opt Byval PB_Name As String, Opt Byval location As String, Opt Byval model As String) Method GetSystemInformation <1610809347> (Byval PB_Name As String) As Variant Method ServiceStart <1610809348> (Byval ServiceName As String, Byval Persistent As Variant) As Variant Method ServiceStop <1610809349> (Byval ServiceName As String, Byval Persistent As Variant) As Variant Method IsServiceRunning <1610809350> (Byval ServiceName As String) As Variant Method CanStartStopService <1610809351> (Byval ServiceName As String) As Variant Method ShowBrowserBar <1610809352> (Byval bstrClsid As String, Byval bShow As Variant) As Variant End Interface ' Interface Name : IShellDispatch3 ' Description : Updated IShellDispatch Interface IShellDispatch3 $IID_Shell32_IShellDispatch3 Inherit IDispatch Property Get Application <1610743808> () As IDispatch Property Get Parent <1610743809> () As IDispatch Method NameSpace <1610743810> (Byval vDir As Variant) As Folder Method BrowseForFolder <1610743811> (Byval Hwnd As Long, Byval Title As String, Byval Options As Long, Opt Byval _ RootFolder As Variant) As Folder Method Windows <1610743812> () As IDispatch Method Open <1610743813> (Byval vDir As Variant) Method Explore <1610743814> (Byval vDir As Variant) Method MinimizeAll <1610743815> () Method UndoMinimizeALL <1610743816> () Method FileRun <1610743817> () Method CascadeWindows <1610743818> () Method TileVertically <1610743819> () Method TileHorizontally <1610743820> () Method ShutdownWindows <1610743821> () Method Suspend <1610743822> () Method EjectPC <1610743823> () Method SetTime <1610743824> () Method TrayProperties <1610743825> () Method Help <1610743826> () Method FindFiles <1610743827> () Method FindComputer <1610743828> () Method RefreshMenu <1610743829> () Method ControlPanelItem <1610743830> (Byval szDir As String) Method IsRestricted <1610809344> (Byval Group As String, Byval Restriction As String) As Long Method ShellExecute <1610809345> (Byval File As String, Opt Byval vArgs As Variant, Opt Byval vDir As Variant, Opt Byval _ vOperation As Variant, Opt Byval vShow As Variant) Method FindPrinter <1610809346> (Opt Byval PB_Name As String, Opt Byval location As String, Opt Byval model As String) Method GetSystemInformation <1610809347> (Byval PB_Name As String) As Variant Method ServiceStart <1610809348> (Byval ServiceName As String, Byval Persistent As Variant) As Variant Method ServiceStop <1610809349> (Byval ServiceName As String, Byval Persistent As Variant) As Variant Method IsServiceRunning <1610809350> (Byval ServiceName As String) As Variant Method CanStartStopService <1610809351> (Byval ServiceName As String) As Variant Method ShowBrowserBar <1610809352> (Byval bstrClsid As String, Byval bShow As Variant) As Variant Method AddToRecent <1610874880> (Byval varFile As Variant, Opt Byval bstrCategory As String) End Interface ' Interface Name : IShellDispatch4 ' Description : Updated IShellDispatch Interface IShellDispatch4 $IID_Shell32_IShellDispatch4 Inherit IDispatch Property Get Application <1610743808> () As IDispatch Property Get Parent <1610743809> () As IDispatch Method NameSpace <1610743810> (Byval vDir As Variant) As Folder Method BrowseForFolder <1610743811> (Byval Hwnd As Long, Byval Title As String, Byval Options As Long, Opt Byval _ RootFolder As Variant) As Folder Method Windows <1610743812> () As IDispatch Method Open <1610743813> (Byval vDir As Variant) Method Explore <1610743814> (Byval vDir As Variant) Method MinimizeAll <1610743815> () Method UndoMinimizeALL <1610743816> () Method FileRun <1610743817> () Method CascadeWindows <1610743818> () Method TileVertically <1610743819> () Method TileHorizontally <1610743820> () Method ShutdownWindows <1610743821> () Method Suspend <1610743822> () Method EjectPC <1610743823> () Method SetTime <1610743824> () Method TrayProperties <1610743825> () Method Help <1610743826> () Method FindFiles <1610743827> () Method FindComputer <1610743828> () Method RefreshMenu <1610743829> () Method ControlPanelItem <1610743830> (Byval szDir As String) Method IsRestricted <1610809344> (Byval Group As String, Byval Restriction As String) As Long Method ShellExecute <1610809345> (Byval File As String, Opt Byval vArgs As Variant, Opt Byval vDir As Variant, Opt Byval _ vOperation As Variant, Opt Byval vShow As Variant) Method FindPrinter <1610809346> (Opt Byval PB_Name As String, Opt Byval location As String, Opt Byval model As String) Method GetSystemInformation <1610809347> (Byval PB_Name As String) As Variant Method ServiceStart <1610809348> (Byval ServiceName As String, Byval Persistent As Variant) As Variant Method ServiceStop <1610809349> (Byval ServiceName As String, Byval Persistent As Variant) As Variant Method IsServiceRunning <1610809350> (Byval ServiceName As String) As Variant Method CanStartStopService <1610809351> (Byval ServiceName As String) As Variant Method ShowBrowserBar <1610809352> (Byval bstrClsid As String, Byval bShow As Variant) As Variant Method AddToRecent <1610874880> (Byval varFile As Variant, Opt Byval bstrCategory As String) Method WindowsSecurity <1610940416> () Method ToggleDesktop <1610940417> () Method ExplorerPolicy <1610940418> (Byval bstrPolicyName As String) As Variant Method GetSetting <1610940419> (Byval lSetting As Long) As Integer End Interface ' Interface Name : DSearchCommandEvents ' Description : Event interface for command events ' ClassID : $CLSID_Shell32_Event_DSearchCommandEvents Class Class_DSearchCommandEvents $CLSID_Shell32_Event_DSearchCommandEvents As Event Interface DSearchCommandEvents $IID_Shell32_DSearchCommandEvents Inherit IDispatch Method SearchStart <1> () ' Insert your code here End Method Method SearchComplete <2> () ' Insert your code here End Method Method SearchAbort <3> () ' Insert your code here End Method Method RecordsetUpdate <4> () ' Insert your code here End Method Method ProgressTextChanged <5> () ' Insert your code here End Method Method SearchError <6> () ' Insert your code here End Method Method SearchRestored <7> () ' Insert your code here End Method End Interface End Class ' Interface Name : IFileSearchBand ' Description : IFileSearchBand Interface ' ClassID : $CLSID_Shell32_FileSearchBand Interface IFileSearchBand $IID_Shell32_IFileSearchBand Inherit IDispatch Method SetFocus <1> () Method SetSearchParameters <2> (ByRef In pbstrSearchID As String, Byval bNavToResults As Integer, Opt ByRef In pvarScope _ As Variant, Opt ByRef In pvarQueryFile As Variant) Property Get SearchID <3> () As String Property Get Scope <4> () As Variant Property Get QueryFile <5> () As Variant End Interface ' Interface Name : IWebWizardHost ' Description : IWebWizardHost interface Interface IWebWizardHost $IID_Shell32_IWebWizardHost Inherit IDispatch Method FinalBack <0> () Method FinalNext <1> () Method Cancel <2> () Property Set Caption <3> (ByVal pbstrCaption As String) Property Get Caption <3> () As String Property Set Property <4> (ByVal bstrPropertyName As String, ByRef In pvProperty As Variant) Property Get Property <4> (ByVal bstrPropertyName As String) As Variant Method SetWizardButtons <5> (Byval vfEnableBack As Integer, Byval vfEnableNext As Integer, Byval vfLastPage As Integer) Method SetHeaderText <6> (Byval bstrHeaderTitle As String, Byval bstrHeaderSubtitle As String) End Interface ' Interface Name : INewWDEvents ' Description : INewWDEvents interface Interface INewWDEvents $IID_Shell32_INewWDEvents Inherit IDispatch Method FinalBack <0> () Method FinalNext <1> () Method Cancel <2> () Property Set Caption <3> (ByVal Rhs As String) Property Get Caption <3> () As String Property Set Property <4> (ByVal bstrPropertyName As String, ByRef In Rhs As Variant) Property Get Property <4> (ByVal bstrPropertyName As String) As Variant Method SetWizardButtons <5> (Byval vfEnableBack As Integer, Byval vfEnableNext As Integer, Byval vfLastPage As Integer) Method SetHeaderText <6> (Byval bstrHeaderTitle As String, Byval bstrHeaderSubtitle As String) Method PassportAuthenticate <7> (Byval bstrSignInUrl As String) As Integer End Interface ' Interface Name : IPassportClientServices ' Description : IPassportClientServices ' ClassID : $CLSID_Shell32_PassportClientServices Interface IPassportClientServices $IID_Shell32_IPassportClientServices Inherit IDispatch Method MemberExists <0> (Byval bstrUser As String, Byval bstrPassword As String) As Integer End Interface
Leave a comment:
-
Create ZIP file using Windows Shell COM interface
Windows XP and above has the built-in ability to create zip files. I found an example on the internet to tap in to this function. But it was in C# so I translated it to PowerBasic Windows 9.00 code.
Post comments or questions here: http://www.powerbasic.com/support/pb...ad.php?t=38472
Enjoy.
Code:'============================================================================== ' Example of how to create a zip file using windows built-in ZIP capibilities ' Created by William Burns using PB 9.00 on 09/03/2008 ' ' Note: Requires Windows XP or newer. ' '============================================================================== #COMPILER PBWIN 9 #COMPILE EXE #DIM ALL #INCLUDE "WinShell.inc" 'created by the PowerBasic Com browser on Shell32 lib 'adjust these constants to match your folder and zip file $SourceFolder = "C:\MyTestFolder" $DestinationZip = "c:\MyNewZip.ZIP" '============================================================================== FUNCTION PBMAIN local hFile as dword 'Object Variables DIM oShellClass AS IShellDispatch DIM oSourceFolder AS Folder DIM oTargetFolder AS Folder DIM oItems AS FolderItems 'variants DIM vSourceFolder AS VARIANT DIM vTargetFolder AS VARIANT DIM vOptions AS VARIANT 'First we create a empty ZIP file using a standard zip file header try hFile = freefile open $DestinationZip for output as #hFile print #hFile, Chr$(80,75,5,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) close #hFile catch msgbox "Error creating Zip file.",,Error$(err) exit function end try ' Get an instance of our Windows Shell oShellClass = ANYCOM $PROGID_SHELL32_SHELL ' Did we get the object? If not, terminate this app IF ISFALSE ISOBJECT(oShellClass) OR ERR THEN MSGBOX "Could not get the Windows Shell object.",,"Error:" & str$(err) EXIT FUNCTION END IF 'assign the source folder we want to zip up vSourceFolder = $SourceFolder oSourceFolder = oShellClass.NameSpace(vSourceFolder) IF ISFALSE ISOBJECT(oSourceFolder) OR ERR THEN MSGBOX "Could not get the Source folder object.",,"Error:" & str$(err) goto Terminate END IF 'assign the target folder we want to create (in this case it is a zip file) vTargetFolder = $DestinationZip oTargetFolder = oShellClass.NameSpace(vTargetFolder) IF ISFALSE ISOBJECT(oTargetFolder) OR ERR THEN MSGBOX "Could not get the Target folder object.",,"Error:" & str$(err) goto Terminate END IF 'assign all the items in the source folder to the Items object oItems = oSourceFolder.Items() IF ISFALSE ISOBJECT(oItems) OR ERR THEN MSGBOX "Could not get the Items object.",,"Error:" & str$(err) goto Terminate END IF 'now we start the copy in to the new zip file vOptions = 20 oTargetFolder.CopyHere(oItems, vOptions) IF ERR THEN MSGBOX "Got an Error during the CopyHere method.",,"Error:" & str$(err) goto Terminate END IF 'NOTE: the above copyhere method starts a seperate thread to do the copy 'so the command could return before the copy is finished, so we need to 'allow time to complete. Thus the next Sleep command. sleep 2000 'increase for larger folders MSGBOX "All done! Now wasn't that easy?",,"Windows Zip" Terminate: ' Close all of the Interfaces oItems = NOTHING oTargetFolder = NOTHING oSourceFolder = NOTHING oShellClass = NOTHING END FUNCTION
Last edited by William Burns; 3 Sep 2008, 09:27 PM. Reason: Added the link to the comment thread in Windows forum
Leave a comment: