In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is about how to use WinRar to compress VB. NET files. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
Because some database files (such as Access files) in the process of remote transmission may affect the transmission effect due to the relatively large files. If it is compressed and then transmitted, it will reduce the transmission time, avoid accidents, and ensure the transmission effect. VB programming process using WinRar tools to compress database files, and complete remote transmission, very convenient
The Shell Function
Shell is an internal VB function that executes an executable file and returns a Variant(Double), which represents the process ID of the program if successful, or 0 if unsuccessful.
Shell syntax: Shell(PathName[, WindowStyle]).
PathName is a required parameter. The type is String, which indicates the name of the program to be executed, along with any required parameters or command-line variables, and may also include pathnames.
WindowStyle is optional. Integer type that specifies the style of the window at program runtime. WindowStyle has these values.
constant value description
The VbHide 0 window is hidden and focus moves to the implicit window.
The VbNormalFocus 1 window has focus and reverts to its original size and position.
The VbMinimizedFocus 2 window is displayed as an icon with focus (default).
The VbMaximizedFocus 3 window is a focused window.
The VbNormalNoFocus 4 window is restored to its most recently used size and position, while the currently active window remains active.
The VbMinimizedNoFocus 6 window is displayed as an icon, while the currently active window remains active.
Second, about the use of WinRar
The following describes how to compress and decompress files using the command line in WinRar.
Compression: WINRAR A [-switches] [Files] [@File lists]
For example, if you want to compress try.mdb to C drive, you can WINRAR A C: \try.rar C:\try.mdb
Decompression: if decompressed with directory
WINRAR X [-switches] [Files] [@File lists] [destionation folder\]
If the current directory is decompressed, that is, the directory name is not written when the directory is decompressed
WINRAR E [-switches] [Files] [@File lists] [destionation folder\]
For example, if you want to extract try.rar to C drive, you can WINRAR X C: \try.rar C:\try.mdb
An example of VB. NET file compression
Create a new project in VB, add two buttons Command1, Command2 and Command3 in Form1, and set their Caption attributes to "Compressed File","Uncompressed File" and "Transfer File" respectively. Press Command1 to compress the file try.mdb to try.rar.
Private Sub Command1_Click() Dim Rarexe As String 'WINRAR Execution File Location Dim Source As String 'Original file before compression Dim Target As String 'Compressed target file Dim FileString as String 'String in Shell directive Dim Result As Long Rarexe="C:\program files\winrar\winrar" Source="C:\try.mdb" Target="C:\try.rar" FileString = rarexe & " a " & Target & " " & Source Result = Shell(FileString, vbHide) End Sub
The decompression process is similar. Press Command2 to decompress try.rar to try.mdb. After performing the compression process above, you can delete the file try.mdb to decompress and regenerate try.mdb.
Private Sub Command2_Click() Dim Rarexe As String 'WINRAR Execution File Location Dim Source As String 'Original file before decompression Dim Target As String 'unzipped target file Dim FileString as String 'String in Shell directive Dim Result As Long Rarexe="C:\program files\winrar\winrar" Source="C:\try.rar" Target="C:\try.mdb" FileString = rarexe & " X " & Source & " " & Target Result = Shell(FileString, vbHide) End Sub
Before transferring files from one computer to another, you should know the name of the other computer and use the FileCopy statement. suppose you want to pas that compressed try.rar to the share directory "want" on your computer named "other."
Private Sub Command3_Click() Dim SourceFile, DestinationFile SourceFile ="C:\try.rar " 'Specifies the source file name. DestinationFile = "\\other\want\try.rar" 'Specifies the destination file name. FileCopy SourceFile, DestinationFile 'Copies the contents of the source file to the destination file. End Sub Thank you for reading! About "how to use WinRar on VB. NET file compression" this article is shared here, I hope the above content can be of some help to everyone, so that we can learn more knowledge, if you think the article is good, you can share it to let more people see it!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.