-2

I need to retrieve address if user is selecting a file for email attachment. is there any way to use window handle to get handle of address bar of open file dialog?

1 Answers1

-1

The following link provides the PInvoke mechanism for calling the Windows GetWindowText which allows you to read the title text of another window.

http://www.pinvoke.net/default.aspx/user32.getwindowtext

PhillipH
  • 6,182
  • 1
  • 15
  • 25
  • Thanks a lot for the help.. My requirement is to capture the file if the user try to attach in email. im using c#. is it possible to capture it?? – user2771590 Sep 26 '16 at 09:43
  • Capture the file, or capture the file name ? Your question was about capturing the file name - not the file itself. I see your comment to someone elses question and its clear you want to capture the File not the File Name. In which case its entirely dependent on which email program your user is using - Outlook, Windows Mail, a Web Mail program of some kind ? Edit your original question to make this clearer please. – PhillipH Sep 26 '16 at 09:47
  • Ok - then no. Your original question said "is there any way to use window handle to get handle of address bar of open file dialog" which I think I answered - however the File Open dialog box doesn't normally contain the name of the file being selected - only the folder currently highlighted. – PhillipH Sep 26 '16 at 09:50
  • Thanks.. is there a way to capture filename if a user try to attach in email in browser (Any mail). I found some reference to use window handle. so i posted this question. – user2771590 Sep 26 '16 at 09:57
  • reference thread [link] (http://stackoverflow.com/questions/24968932/how-to-detect-when-any-file-is-being-attached-uploaded-to-an-email-client-or-ema) – user2771590 Sep 26 '16 at 10:03
  • I cant see any refernce to Window Handle in that thread. It doesnt matter; the answers in your linked thread are still the same; however if you really want to do this you need to go deep down into OS File System Filter Hooks as explained here http://stackoverflow.com/questions/1109564/intercept-windows-open-file – PhillipH Sep 26 '16 at 10:26