how can we capture the file name and path that is selected in my computer or explorer in windows normally in our program...plz any way i fthere plz tell i really need it
Printable View
how can we capture the file name and path that is selected in my computer or explorer in windows normally in our program...plz any way i fthere plz tell i really need it
Well you will need to hook into windows. And for doing that you should have good understanding in Win32 APIs. Start with SetWindowsHook API and then you will find that it will take more than just 1 API to do that.
vikrant3mahajan,
This will capture the file path you select and assign it to a string FileName.
Code:OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
openFileDialog.Filter = "Excel Files (*.xls)|*.xls|All Files (*.*)|*.*";
if (openFileDialog.ShowDialog(this) == DialogResult.OK)
{
string FileName = openFileDialog.FileName;
}
@admdev: The OP is looking for a hook into Windows Explorer here. It doesn't sound like he wants to open his own dialog. Also, you should wrap that in a using statement so that the dialog is disposed of after the code has run ;)