TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ashutosh kumar gupta
NA
190
0
Find which processes are using the file.
May 2 2012 5:15 AM
Hi,
I want to find all the processes which ate using the particular file. If the processes are GUI based then my code will list all the processes which are using the file but if processes are running in background which has no GUI then those processes are not listing.
Is there any way to find all the processes with or without GUI. The code is as...
OpenFileDialog fdlg = new OpenFileDialog();
fdlg.Title = "Open File Dialog";
fdlg.InitialDirectory = @"c:\";
fdlg.Filter = "All files (*.*)|*.*|All files (*.*)|*.*";
fdlg.FilterIndex = 2;
fdlg.RestoreDirectory = true;
if (fdlg.ShowDialog() == DialogResult.OK)
{
txtFleName.Text = fdlg.FileName;
ArrayList listProcesses = getFileProcesses(txtFleName.Text);
if (lstProcesses.Items.Count > 0)
{
lstProcesses.Items.Clear();
}
foreach (Process process in listProcesses)
{
lstProcesses.Items.Add(process.ProcessName);
}
label2.Text = "";
if (lstProcesses.Items.Count > 0)
{
label2.Text = txtFleName.Text + " File is used by these processes.";
}
else
{
label2.Text = "No process is using " + txtFleName.Text + " File.";
}
}
Reply
Answers (
7
)
How to check that the user can start and stop the service with Local System account
How to Create and Use a Windows 7 Password Reset USB