Solved

How to know if a file copy is in progress ?

Posted on 2008-06-24
5
447 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 50 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
FizzBuzz challenge 9 82
best sources to up-to-date in C++? 8 91
Capture logon name 13 87
How do I get Window Title of all opened process? 4 14
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
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 …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

860 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