VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

FileReady Function

Jerry Barnett  (2 Submissions)   Files/File Controls/Input/Output   Visual Basic 3.0   Intermediate   Wed 3rd February 2021

Here is a useful function I created to solve a
problem I was having in processing files for
one of my applications.
This function works better than trying to use
the VB 'OPEN' command because it will always
return the correct state of the file (even on a
file that is being FTP'd at the time of the
test.) See remarks in the FileReady function on
it's use, as well as a sample at the end of this
note.

API Declarations
Public Const SHARE_EXCLUSIVE = &H0
Public Const INVALID_HANDLE_VALUE = -1
Public Const ERROR_ALREADY_EXISTS = 183&
Public Const OPEN_EXISTING = 3
Public Const FILE_ATTRIBUTE_NORMAL = &H80
Public Const GENERIC_READ = &H80000000
Public Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type
Public Declare Function GetLastError Lib "kernel32" () As Long
Public Declare Function CreateFile _
Lib "kernel32" Alias "CreateFileA" _
(ByVal lpFileName As String, _
ByVal dwDesiredAccess As Long, _
ByVal dwShareMode As Long, _
lpSecurityAttributes As SECURITY_ATTRIBUTES, _
ByVal dwCreationDisposition As Long, _
ByVal dwFlagsAndAttributes As Long, _
ByVal hTemplateFile As Long) As Long
Public Declare Function CloseHandle _
Lib "kernel32" (ByVal hObject As Long) As Long

Rate FileReady Function (4(4 Vote))
FileReady Function.bas

FileReady Function Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters