Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
OpenFile
Author:
Dexter
Website:
http://www.ex-designz.net/api.asp
Submitted:
2/17/2005
Version:
VB6
Compatibility:
VB6
Category:
Windows API
Views:
41790
The OpenFile function creates, opens, reopens, or deletes a file.
Declarations:
'Visit http://www.ex-designz.net/api.asp for more API code Const OFS_MAXPATHNAME = 128 Const OF_CREATE = &H1000 Const OF_READ = &H0 Const OF_WRITE = &H1 Private Type OFSTRUCT cBytes As Byte fFixedDisk As Byte nErrCode As Integer Reserved1 As Integer Reserved2 As Integer szPathName(OFS_MAXPATHNAME) As Byte End Type Private Declare Function CopyLZFile Lib "lz32" (ByVal n1 As Long, ByVal n2 As Long) As Long Private Declare Function OpenFile Lib "kernel32" (ByVal lpFileName As String, lpReOpenBuff As OFSTRUCT, ByVal wStyle As Long) As Long Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Code:
Private Sub Form_Load() Dim sFile As String, hDecomp As Long, hResult As Long Dim OF As OFSTRUCT, sSaveTo As String 'Ask for a file to decompress sFile = InputBox("Please, enter a file to decompress.") 'Ask for a file to decompress it to sSaveTo = InputBox("Please, enter a filename to decompress it to.") 'Open the two files hDecomp = OpenFile(sFile, OF, OF_READ) hResult = OpenFile(sSaveTo, OF, OF_WRITE Or OF_CREATE) 'decompress the file CopyLZFile hDecomp, hResult 'Close the two files CloseHandle hDecomp CloseHandle hResult Unload Me End Sub
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement