Results 1 to 5 of 5

Thread: Using the CreateFile and GetFileTime API's

  1. #1

    Thread Starter
    Addicted Member VB6Coder's Avatar
    Join Date
    Apr 2001
    Location
    Northampton, UK
    Posts
    185

    Question Using the CreateFile and GetFileTime API's

    I've always used the CreateFile API to get a file handle, which I can then pass into the GetFileTime API to get the file times. This works fine until I tried to get a file handle to a Microsoft Access Database file which was open in Access.

    Is there another way of getting a file handle that won't fail if the file is locked?
    Last edited by VB6Coder; May 9th, 2001 at 07:15 AM.

  2. #2
    jim mcnamara
    Guest
    Go to VBNET
    Search for "file api"

    Take a look at this code:
    Obtaining and Changing a File's Created, Accessed and Modified Dates
    This uses a different suite of api's.

  3. #3

    Thread Starter
    Addicted Member VB6Coder's Avatar
    Join Date
    Apr 2001
    Location
    Northampton, UK
    Posts
    185

    Thumbs up

    The VBNet example uses the OpenFile API, so I'll give that ago.


    Cheers

  4. #4
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    I think it depends on how the access database was opened. If opened for exclusive use, I don't think you will be able to get a handle.

    In all other situations you should be able to get a handle using create file api.

  5. #5

    Thread Starter
    Addicted Member VB6Coder's Avatar
    Join Date
    Apr 2001
    Location
    Northampton, UK
    Posts
    185

    Thumbs up

    I wasn't opening the Access database exclusive, and for some reason the CreateFile API kept returning me 0.

    I've now changed my code to use the OpenFile API instead of the CreateFile API and that has fixed the problem.


    Cheers Guys

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width