Solved

How to know if a file copy is in progress ?

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
sum13 challenge 24 77
wait notify demo infinite loop 3 80
EvenOdd challenge 10 83
Problem to open Excel file 15 40
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

706 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now