Help? I'm still sort of a new VBasic programmer and the problem described below is a bit beyond my current experience. I suspect I need us use a win32 function call or some type of libary function which I've never had to use before.
I need to write a section of a VBasic program that sits and waits for a file to show-up in a directory. After the file shows up in the directory the program continues on its way through the rest of the program.
My first attempt at this function made use of the Scripting.FileSystemObject. I set up a loop which constantly checked to see if the file was there...if not it went and checked for the file again, and again, and again. Clearly this brought the entire computer to it's knees while waiting for the file to showup.
While looking through various books I came saw that their is a "FindFirstChangeNotification Lib "Kernel32" Alias "FindFirstChangeNotificationA" API function call that is somehow available, however I could not find some real useful sample code.
I could arrange for the file to be the only file that would ever show up in a directory and then look for a change in the directory structure. Regardless, could someone help me here? this will be my first API that I've create using what sounds like a Win32 Library call.....
Anyway here is a summary of what I need:
Directory: c:\test
File that I'm looking for: c:\test\test.txt
Functions should wait for test.txt to show up in the directory c:\test or timeout after 60 seconds.
Other windows applications and vital system functions should be able to continue without having degraded performance while the vbasic program 'sleeps' or 'waits' until the file arrives in the directory.
help??
thanks,
jerry
I need to write a section of a VBasic program that sits and waits for a file to show-up in a directory. After the file shows up in the directory the program continues on its way through the rest of the program.
My first attempt at this function made use of the Scripting.FileSystemObject. I set up a loop which constantly checked to see if the file was there...if not it went and checked for the file again, and again, and again. Clearly this brought the entire computer to it's knees while waiting for the file to showup.
While looking through various books I came saw that their is a "FindFirstChangeNotification Lib "Kernel32" Alias "FindFirstChangeNotificationA" API function call that is somehow available, however I could not find some real useful sample code.
I could arrange for the file to be the only file that would ever show up in a directory and then look for a change in the directory structure. Regardless, could someone help me here? this will be my first API that I've create using what sounds like a Win32 Library call.....
Anyway here is a summary of what I need:
Directory: c:\test
File that I'm looking for: c:\test\test.txt
Functions should wait for test.txt to show up in the directory c:\test or timeout after 60 seconds.
Other windows applications and vital system functions should be able to continue without having degraded performance while the vbasic program 'sleeps' or 'waits' until the file arrives in the directory.
help??
thanks,
jerry