-
ReadDirectoryChangesW
I need to use the ReadDirectoryChanges API Function through VB6.
All the structures needed seemed to be correctly declared and the compilator
returns no error.
But the FILE_NOTIFY_INFORMATION structure only receives the value 259 in
the BytesReturned field and all the other fields are left blank.
Can someone help me with a sample source code or even just an advice...
Thanks a lot for interesting in my problem and all apologies for my poor
english (I'm French... ;-)
-
Re: ReadDirectoryChangesW
FILE_NOTIFY_INFORMATION is a variable-lengthed self-relative structure. You
need to pass a raw buffer of type byte array to ReadDirectoryChangesW. You
then iterate the buffer using CopyMemory to copy the fixed portion of the
FILE_NOTIFY_INFORMATION structure to a variable of type
FILE_NOTIFY_INFORMATION. I would define the FileName parameter as a byte
array of size 255. The NextEntryOffset field tells you where the next record
is located relative to your current position.
Also, don't trust ReadDirectoryChangesW on remote machines, it misses.
HTH
++++++++++++++++++++
Monte Hansen
http://KillerVB.com
++++++++++++++++++++
"nikita" <nikita22h90@aol.com> wrote in message
news:3c3a3096$1@147.208.176.211...
>
> I need to use the ReadDirectoryChanges API Function through VB6.
> All the structures needed seemed to be correctly declared and the
compilator
> returns no error.
> But the FILE_NOTIFY_INFORMATION structure only receives the value 259 in
> the BytesReturned field and all the other fields are left blank.
> Can someone help me with a sample source code or even just an advice...
>
> Thanks a lot for interesting in my problem and all apologies for my poor
> english (I'm French... ;-)
-
Re: ReadDirectoryChangesW
FILE_NOTIFY_INFORMATION is a variable-lengthed self-relative structure. You
need to pass a raw buffer of type byte array to ReadDirectoryChangesW. You
then iterate the buffer using CopyMemory to copy the fixed portion of the
FILE_NOTIFY_INFORMATION structure to a variable of type
FILE_NOTIFY_INFORMATION. I would define the FileName parameter as a byte
array of size 255. The NextEntryOffset field tells you where the next record
is located relative to your current position.
Also, don't trust ReadDirectoryChangesW on remote machines, it misses.
HTH
++++++++++++++++++++
Monte Hansen
http://KillerVB.com
++++++++++++++++++++
"nikita" <nikita22h90@aol.com> wrote in message
news:3c3a3096$1@147.208.176.211...
>
> I need to use the ReadDirectoryChanges API Function through VB6.
> All the structures needed seemed to be correctly declared and the
compilator
> returns no error.
> But the FILE_NOTIFY_INFORMATION structure only receives the value 259 in
> the BytesReturned field and all the other fields are left blank.
> Can someone help me with a sample source code or even just an advice...
>
> Thanks a lot for interesting in my problem and all apologies for my poor
> english (I'm French... ;-)
-
Re: ReadDirectoryChangesW
Could someone tell me how to declare and use the ReadDirectoryChangesW
with VB6?
I read the MSDN docs but it didn't help me a lot.
Any little help will be apreciated.
Dante
-
Re: ReadDirectoryChangesW
Could someone tell me how to declare and use the ReadDirectoryChangesW
with VB6?
I read the MSDN docs but it didn't help me a lot.
Any little help will be apreciated.
Dante
-
Re: ReadDirectoryChangesW
heres my best guess...
'BOOL ReadDirectoryChangesW(
' HANDLE hDirectory, // handle to the directory to be watched
' LPVOID lpBuffer, // pointer to the buffer to receive the read
' // results
' DWORD nBufferLength, // length of lpBuffer
' BOOL bWatchSubtree, // flag for monitoring directory or
' // directory tree
' DWORD dwNotifyFilter, // filter conditions to watch for
' LPDWORD lpBytesReturned, // number of bytes returned
' LPOVERLAPPED lpOverlapped,
' // pointer to structure needed for
' // overlapped I/O
' LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
' // pointer to completion routine
');
Public Type OVERLAPPED
Internal As Long
InternalHigh As Long
offset As Long
OffsetHigh As Long
hEvent As Long
End Type
Private Declare Function ReadDirectoryChangesW Lib "Kernel32" _
(ByVal hDirectory As Long, _
lpBuffer As Any, _
nBufferLength As Long, _
bWatchSubtree As Long, _
dwNotifyFilter As Long, _
lpBytesReturned As Long, _
lpOverlapped As OVERLAPPED, _
ByVal lpCompletionRoutine As Long _
) As Long
"Dante" <aldokappa@hotmail.com> wrote in message
news:3c3c0fee$1@147.208.176.211...
>
> Could someone tell me how to declare and use the ReadDirectoryChangesW
> with VB6?
> I read the MSDN docs but it didn't help me a lot.
>
> Any little help will be apreciated.
> Dante
-
Re: ReadDirectoryChangesW
heres my best guess...
'BOOL ReadDirectoryChangesW(
' HANDLE hDirectory, // handle to the directory to be watched
' LPVOID lpBuffer, // pointer to the buffer to receive the read
' // results
' DWORD nBufferLength, // length of lpBuffer
' BOOL bWatchSubtree, // flag for monitoring directory or
' // directory tree
' DWORD dwNotifyFilter, // filter conditions to watch for
' LPDWORD lpBytesReturned, // number of bytes returned
' LPOVERLAPPED lpOverlapped,
' // pointer to structure needed for
' // overlapped I/O
' LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
' // pointer to completion routine
');
Public Type OVERLAPPED
Internal As Long
InternalHigh As Long
offset As Long
OffsetHigh As Long
hEvent As Long
End Type
Private Declare Function ReadDirectoryChangesW Lib "Kernel32" _
(ByVal hDirectory As Long, _
lpBuffer As Any, _
nBufferLength As Long, _
bWatchSubtree As Long, _
dwNotifyFilter As Long, _
lpBytesReturned As Long, _
lpOverlapped As OVERLAPPED, _
ByVal lpCompletionRoutine As Long _
) As Long
"Dante" <aldokappa@hotmail.com> wrote in message
news:3c3c0fee$1@147.208.176.211...
>
> Could someone tell me how to declare and use the ReadDirectoryChangesW
> with VB6?
> I read the MSDN docs but it didn't help me a lot.
>
> Any little help will be apreciated.
> Dante
-
Re: ReadDirectoryChangesW
Actually, as a matter of practice, I would declare it like so (:
Declare Function ReadDirectoryChangesW(...
Byval hDirectory as Long , _
lpBuffer As Any, {watch this param!}
Byval nBufferLength As Long, _
Byval bWatchSubtree As Long, _
Byval dwNotifyFilter As Long, _
byref lpBytesReturned as Long, _
Byval lpOverlapped As Long, _
Byval lpCompletionRoutine As Long)As Long
This is improv, so I hope I didn't get it wrong.
+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+
Monte Hansen
http://KillerVB.com
+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+
"dnagel" <GrandNagel@hotmail.com> wrote:
>heres my best guess...
>
>'BOOL ReadDirectoryChangesW(
>' HANDLE hDirectory, // handle to the directory to be watched
>' LPVOID lpBuffer, // pointer to the buffer to receive the read
>' // results
>' DWORD nBufferLength, // length of lpBuffer
>' BOOL bWatchSubtree, // flag for monitoring directory or
>' // directory tree
>' DWORD dwNotifyFilter, // filter conditions to watch for
>' LPDWORD lpBytesReturned, // number of bytes returned
>' LPOVERLAPPED lpOverlapped,
>' // pointer to structure needed for
>' // overlapped I/O
>' LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
>' // pointer to completion routine
>');
>
>Public Type OVERLAPPED
> Internal As Long
> InternalHigh As Long
> offset As Long
> OffsetHigh As Long
> hEvent As Long
>End Type
>
>Private Declare Function ReadDirectoryChangesW Lib "Kernel32" _
> (ByVal hDirectory As Long, _
> lpBuffer As Any, _
> nBufferLength As Long, _
> bWatchSubtree As Long, _
> dwNotifyFilter As Long, _
> lpBytesReturned As Long, _
> lpOverlapped As OVERLAPPED, _
> ByVal lpCompletionRoutine As Long _
> ) As Long
>
>
>"Dante" <aldokappa@hotmail.com> wrote in message
>news:3c3c0fee$1@147.208.176.211...
>>
>> Could someone tell me how to declare and use the ReadDirectoryChangesW
>> with VB6?
>> I read the MSDN docs but it didn't help me a lot.
>>
>> Any little help will be apreciated.
>> Dante
>
>
-
Re: ReadDirectoryChangesW
Actually, as a matter of practice, I would declare it like so (:
Declare Function ReadDirectoryChangesW(...
Byval hDirectory as Long , _
lpBuffer As Any, {watch this param!}
Byval nBufferLength As Long, _
Byval bWatchSubtree As Long, _
Byval dwNotifyFilter As Long, _
byref lpBytesReturned as Long, _
Byval lpOverlapped As Long, _
Byval lpCompletionRoutine As Long)As Long
This is improv, so I hope I didn't get it wrong.
+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+
Monte Hansen
http://KillerVB.com
+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+
"dnagel" <GrandNagel@hotmail.com> wrote:
>heres my best guess...
>
>'BOOL ReadDirectoryChangesW(
>' HANDLE hDirectory, // handle to the directory to be watched
>' LPVOID lpBuffer, // pointer to the buffer to receive the read
>' // results
>' DWORD nBufferLength, // length of lpBuffer
>' BOOL bWatchSubtree, // flag for monitoring directory or
>' // directory tree
>' DWORD dwNotifyFilter, // filter conditions to watch for
>' LPDWORD lpBytesReturned, // number of bytes returned
>' LPOVERLAPPED lpOverlapped,
>' // pointer to structure needed for
>' // overlapped I/O
>' LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
>' // pointer to completion routine
>');
>
>Public Type OVERLAPPED
> Internal As Long
> InternalHigh As Long
> offset As Long
> OffsetHigh As Long
> hEvent As Long
>End Type
>
>Private Declare Function ReadDirectoryChangesW Lib "Kernel32" _
> (ByVal hDirectory As Long, _
> lpBuffer As Any, _
> nBufferLength As Long, _
> bWatchSubtree As Long, _
> dwNotifyFilter As Long, _
> lpBytesReturned As Long, _
> lpOverlapped As OVERLAPPED, _
> ByVal lpCompletionRoutine As Long _
> ) As Long
>
>
>"Dante" <aldokappa@hotmail.com> wrote in message
>news:3c3c0fee$1@147.208.176.211...
>>
>> Could someone tell me how to declare and use the ReadDirectoryChangesW
>> with VB6?
>> I read the MSDN docs but it didn't help me a lot.
>>
>> Any little help will be apreciated.
>> Dante
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks