0

I want to required file name of my currently opened document application(like pdf,docx,xls etc) in order to automatically detect the password from my access database. But when i clicked on my external application the "password" window gets opened since my file application is passwords protected, still file application not opened because i have not entered password still, i want to supply this password as auto detection from database. For this project i have got the title of currently active window i.e. password but i want to know the which file name, of application.

The filename with extension is present on external application(pdf,docx,xls)"enter password" dialog box or window. So my question is that is there any way to read out this "filename+extension " present on "enter password" dialog box of external application(like pdf,docx,xls etc).

Bobrovsky
  • 13,789
  • 19
  • 80
  • 130
sham
  • 422
  • 4
  • 18
  • 1
    Could you post code for what you have tried so far? I'm afraid your problem description isn't making too much sense to me. – Dutts Feb 18 '13 at 15:27
  • You tell me is there any way to getting or read out the text present on the external dialog box(for example enter password) of other application like pdf or docx – sham Feb 18 '13 at 15:38
  • You will have to access the Windows API functions for this through Interop, have a look at http://blogs.msdn.com/b/oldnewthing/archive/2008/10/06/8969399.aspx and http://www.csharphelp.com/2006/08/get-current-window-handle-and-caption-with-windows-api-in-c/ for a starting point – Dutts Feb 18 '13 at 15:43

1 Answers1

0

You need to access the Windows API through PInvoke for this.

First, you need to get the handle of the window you are interested in, look at this for some example code.

Then you can get the text from the title bar using this method described here.

Hopefully this should be enough to get you started.

Community
  • 1
  • 1
Dutts
  • 5,781
  • 3
  • 39
  • 61
  • actually you can not getting my question. – sham Feb 18 '13 at 16:33
  • Ah @ShamBhand sorry I misinterpreted your question, I assumed the filename was in the window title, I think you may struggle to get the text from an arbitrary window with no further knowledge the implementation of the 3rd party dialog – Dutts Feb 18 '13 at 16:47
  • Whatever you told me i have already tried it and getting caption and handle of currently active window or say chile window as dialog box.But my requirement is that i want to read out whole text information present on the dialog box or window(like enter password) of external application(pdf, docx) so i will getting name of file with its extension. – sham Feb 18 '13 at 16:47
  • so Is there any way to getting or read out text information present on this 3rd party dialog or say window?? – sham Feb 18 '13 at 16:52