CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2009
    Posts
    20

    Question capturing explorer events

    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

  2. #2
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: capturing explorer events

    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.

  3. #3
    Join Date
    Sep 2008
    Posts
    91

    Re: capturing explorer events

    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;
    
    
                    }

  4. #4
    Join Date
    Jun 2008
    Posts
    2,477

    Re: capturing explorer events

    @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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured