Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6078793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:52:24+00:00 2026-05-23T10:52:24+00:00

I have a thread that uses ReadDirectoryChangesW to notify me when a file is

  • 0

I have a thread that uses ReadDirectoryChangesW to notify me when a file is added or deleted in a folder.

For each new image, I open the file and create a thumbnail of the image. It would seem however that I receive the notification before the file is completely copied to the destination folder, in which case I only get a partial thumbnail. (Files are copied from remote locations onto a central server and the network can get slow in peak times.)

I do check if the file is in use, but this does not seem to work with image files.

HFileRes := CreateFile(pchar(Filename), GENERIC_READ or GENERIC_WRITE, 0, nil,   OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0) ;
Result := (HFileRes = INVALID_HANDLE_VALUE);
if (not Result) then
  CloseHandle(HFileRes) ;

My question is this: Is there a way to detect when a file is completely copied or do I just wait until the file size or last modification time has not changed since the last time I checked?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:52:25+00:00Added an answer on May 23, 2026 at 10:52 am

    To be sure if file transfer is finished check first if you can get exclusive access.

      FileHandle := FileOpen(FileName, fmOpenRead or fmShareExclusive);
      if FileHandle > 0 then
        {valid file handle}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have app that uses two threads: one thread for regular application work and
Hi I have a thread that uses couple of variables. variables are determined in
I have a extension that uses multithreading using worker thread as shown here .
I have a multi-thread C# application that uses some recursive functions in a dll.
I have a thread that uses a handler to post a runnable instance. it
I have a Service that uses a custom Connection class (extends thread) to a
Using Java 6: I have a method that uses a Thread to run a
I have a python script that uses threads and makes lots of HTTP requests.
I have a server application that uses a lot of threads. Without wanting to
I have one thread that writes results into a Queue. In another thread (GUI),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.