Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to know if a file copy is in progress ?

Posted on 2008-06-24
5
Medium Priority
?
462 Views
Last Modified: 2013-11-20
Hello every body,

In an application written using VC++2005 with MFC support, is there a way to know if a file copy is in progress (some where else in windows, not especially in my application) ?

Thanks in advance,
Mike
0
Comment
Question by:mike_marquet
  • 2
  • 2
5 Comments
 
LVL 40

Expert Comment

by:evilrix
ID: 21854247
Suggestion: Try to obtain an exclusive lock on the file, if you can't it's probably being modified.
http://msdn.microsoft.com/en-us/library/aa365203(VS.85).aspx
0
 

Author Comment

by:mike_marquet
ID: 21854525
It's not want I want. I don't know anything about the file.
I only want to know if a FileCopy is somewhere in progress what else which file is being copied.
0
 
LVL 40

Expert Comment

by:evilrix
ID: 21854538
Oh, ok. I might help to know why you want to do this -- what's the rational? There might be a different way to approach this.
0
 

Author Comment

by:mike_marquet
ID: 21854656
If a file copy is in progress, I must disable some controls in my application.
0
 
LVL 19

Accepted Solution

by:
mrwad99 earned 200 total points
ID: 21858088
At first thought you would need to hook the API functions CopyFile and CopyFileEx, as I would imagine most copying on the system would employ one of those API functions.  Wait for the function to exit, then you know the copy has been completed so you can enable your controls.

That said, I don't know much about it myself, although if you look hard enough I am sure there is some info out there about hooking API function calls.

HTH
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question